Is it possible to change log4j settings during application execution?
You can use PropertyConfigurator.configureAndWatch to make log4j spawn a thread to periodically check your properties file for changes.
Alternatively, you can use JMX described in this post: Change Logging Levels using JMX
There ways of doing this by making your Log4j accessible through JMX and using a JMX console to control the filters, loggers, levels, appenders etc...
I have an example somewhere but I need to prune it a little to make it understandable. Would you want this ?
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