I'm working on a project where we want to dynamically configure log4j
during a run.

We want to change log levels, appenders, and filters in real time.

The "configureAndWait()" method doesn't look like it would work well
for our needs because:

1)      It would be a performance hog if we wanted it to act "real
time" (delay < 500 ms)

2)      We don't want to persist configuration changes from run to run
(and if we write to the file that would be the default)

 

So I was thinking of loading the config file, and for dynamic changes
simply changing the properties objects and calling the reset and
configure methods.  I am confused, though, on why the
PropertyConfigurator doesn't allow dynamic changes to filters (and only
the DOMConfigurator does).  I looked at the DOMConfigurator briefly and
I see that it calls the "addFilter() method of appender"  Is there any
reason why the PropertyConfigurator doesn't do this?  Would it be ok
for me to use a PropertyConfigurator, and call "addFilter()" to deal
with filter changes myself?  I ask because I think connecting a UI with
DOMConfigurator would be a bit clumsy, I'd have to hand craft XML for
each change I want to send back.

Reply via email to