logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joachim Kanbach" <jo...@gmx.de>
Subject Re: How to consolidate Server and Application Logging in GlassFish?
Date Wed, 02 Mar 2016 08:14:26 GMT
I'm afraid I was talking too soon: the reason that the other threads went away is because my
CronTriggeringPolicy was removed from the RollingFileManager. I debugged and looked at the
source; both the RolloverStrategy and the TriggeringPolicy are stored with the RollingFileManager
and NOT the RollingFileAppender. So when my applications got deployed, their configuration
overwrote the shared RollingFileManager's TriggeringPolicy, i.e. no cron triggering occurs
anymore. I'll have to find a different solution.

> I think I've found a solution to this that solves all of my problems: I defined a RollingFileAppender
in each application's separate log4j2.xml configuration file, all of which point to the same
file (server.log) like the log4j2.xml used by GlassFish. I found from the source code that
in this setup, all RollingFileAppenders do share the same RollingFileManager indeed, so concurrent
writing to the file is no issue. To prevent one of the applications' appenders from actually
performing a rollover and instead let the GlassFish appender do that, I defined a SizeBasedTriggeringPolicy
in the applications' log4j2.xml with an exceedingly large size.
> 
> This has the positive side effect that only a single "Log4j2-Log4j2Scheduled-X" ever
exists, regardless how often I redeploy any of the applications.

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


Mime
View raw message