[logback-user] Should logback.xml be in part of a web app?

Sebastien Pennec sebastien at qos.ch
Mon Mar 12 14:29:44 CET 2007


Hello Keith,

Well, I would recommend that you put the configuration file outside of the EAR, so 
that you can make it evolve without having to repackage everything... With the 
configuration file inside the EAR, it is frozen until you repackage your app.

But if you really cannot proceed this way because of company policies, then you have 
a few possibilities to change the configuration.

The first thing you can do is use JMX. Logback ships with a JMXConfigurator[1] that 
allows you to reload the context, but also to change a logger's level.

It is also possible to change the level of a logger programmatically. I can imagine a 
kind of admin-app that would retrieve a logger and change its level.

Hope this helps,

Sébastien

[1]http://logback.qos.ch/jmxConfig.html

Keith wrote:
> Hi:
> Can you please give some recommendation if I should include logback.xml 
> in an EAR or outside on a file system? In the past, I would put it 
> outside on a file system so that I can change the logging level on the 
> fly when a need arises to log in detail. However, in this new company 
> which I recently join, it prefers that everything be packaged in a EAR 
> to "reduce work" for the deployment team.
> 
> Given such option, how do I change the level of logging easily if the 
> logback.xml is packaged in an EAR? Can I still be able to change the 
> level of logging programmatically  on the fly, or perhaps using JMX? 
> Will I be able to save the change into the file in the EAR?
> 
> Thanks,
> Keith
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
> 

-- 
Sébastien Pennec
sebastien at qos.ch

Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch/



More information about the Logback-user mailing list