views:

30

answers:

1

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 ?

+1  A: 

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.

Brian Agnew
ok, that's not good news, but thanks for the answer :)
moolsan