[logback-user] Resetting Loggers Once Programmatically Changed

James Morgan james.morgan.e at gmail.com
Fri Aug 17 13:05:55 CEST 2012


Hi all,

I have implemented a servlet which can be included with my applications
that allowed me to programmatically change logging properties on the file,
for example ,Changing logging levels, adding loggers, showing all loggers
either with explicit levels or not.

My problem is that I would like to do *two* additional things with the
servlet and I have no idea how to achieve them?:

*1st* - I would like to reset loggers to the application defaults defined
in my logback.xml file. Previously when I had implementation of this using
Log4J I simply used the system property *log4j.configuration* to get hold
of the file, then called
*DOMConfigurator.configure(Loader.getResource(filename))
*which then reloaded the log4j config file. As I now do not set a system
property I cannot work out how to get hold of the my logback.xml
configuration file to re-load it, even if I got hold of it is there a way
of resetting/reloading my configuration?

*2nd* - Secondly in a similar context as part of my servlet I can
explicitly add new loggers with new levels e.g. If I have the class *
com.james.morgan.myapplication.Class123* which contains a logger I can
override the default level for *com.james.morgan* and add a new logger
*com.james.morgan.myapplication.Class123
*with a different level, however once I am finished the only way I can put
the logger back to the default level is to set the new logger which I have
added to the default level, what I what is the ability to delete a logger
but again cannot find any documentation on this?


Thanks for any help or suggestions with my problems,

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120817/3d35798d/attachment.html>


More information about the Logback-user mailing list