My application for some reasons programatically reconfigures log4j (in some circumstances), namely custom appenders are registered. However the changes are lost as soon someone edits the log4j configuration file manually.
How to make sure our programatic changes to log4j configuration are not lost? Or how to get notified when log4j re-configuration happens?
The application runs on JBoss and the problem happens when its $JBOSS/server/default/conf/jboss-log4j.xml file is edited, but I believe the issue is not specific to JBoss AS at all.
You could, I suppose periodically poll the Log4j API asking if your custom appenders are attached (using
Category.isAttached(appender)), and re-attach if necessary. It’s rather clunky, but I don’t know of any notification mechanism for this.