I wonder if there is a non-programatical way of making log4j aware of changes on the configuration at runtime. I know I can use
static {
PropertyConfigurator.configureAndWatch("log4j.properties", 100);
}
at some useful place to watch a property file for changes, but I would prefer an option within the property file itself, to tell log4j watch for changes. Are there any ?
Log4j has some JMX capabilities which means you can adjust some features dynamically (particularly filtering on level).
Howeever I don't believe you can do much more than that. Appenders have no concept of a lifecycle, which they'd likely need to be able to reliably open/close resources upon reconfiguration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With