ppkarwasz commented on issue #3352: URL: https://github.com/apache/logging-log4j2/issues/3352#issuecomment-2569233815
@Patrick-Harms, > The issue, at initial investigation, is that all the processes want to be Master, and roll the file. That causes an error, and on the next log message, the process then gets a hard error that the stream is closed. The rolling file appender does not support logging to the same file from **separate** JVMs, because there is no reliable mechanism in Java to decide which process will be the "primary" process, i.e. will actually perform the rotation. The same log file can only be reused by multiple applications in the same **application server** (see [note on `RollingFileManager` sharing](https://logging.apache.org/log4j/2.x/manual/appenders/rolling-file.html#appenders)). Even if you solve the problem of files being rotated multiple times, other features of the rolling file appender will still not work with multiple JVMs: e.g. the [`SizeBasedTriggeringPolicy`](https://logging.apache.org/log4j/2.x/manual/appenders/rolling-file.html#SizeBasedTriggeringPolicy) will not take into account the logs from other JVMs to determine the current size of the log file. As mentioned by @swebb2066, if you want to use the same files in multiple applications, you should forward all the logs to an external application, like the mentioned [Fluent Bit](https://fluentbit.io/), [Fluentd](https://www.fluentd.org/) or the common [RSyslog](https://www.rsyslog.com/). Note that Log4j Core has specialized [RFC 5424](https://logging.apache.org/log4j/2.x/manual/layouts.html#RFC5424Layout) and [RFC 3164 layouts](https://logging.apache.org/log4j/2.x/manual/layouts.html#SyslogLayout) to format log events in a way recognized by Syslog. You can combine them with a file or [socket appender](https://logging.apache.org/log4j/2.x/manual/appenders/network.html#SocketAppender) to send messages to RSyslog. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org