I just saw some information in the Log4j documentation that makes me believe 
that my solution b) would actually work, particularly if I use a separate 
configuration for each application that uses a RollingFileAppender writing to 
the same file:

"While RolloverFileAppenders from different Configurations cannot be shared, 
the RollingFileManagers can be if the Manager is accessible. For example, two 
web applications in a servlet container can have their own configuration and 
safely write to the same file if Log4j is in a ClassLoader that is common to 
both of them." 
(https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender)

Is my understanding correct that my proposed solution b) will not cause 
problems then due to different RollingFileAppenders writing to the same file?

But how could I then achieve that there's only a single thread that takes care 
of the daily log rotation (the one defined in the log4j2.xml configuration used 
as a system parameter for GlassFish) without screwing all the other appenders? 
Could I use plain FileAppenders in the application configurations? Or could I 
use RollingFileAppenders without any rotation policies defined?

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to