[logback-user] Enable Debugging Mode Programmatically?

Andrew Bourgeois andrew.bourgeois at hotmail.com
Tue Dec 13 21:42:25 CET 2011


Hello Jack

I don't know how to do it for the rootLogger, but here's how I did enable a 
debug level for my whole app:
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
lc.getLogger("be.mydomain.testapp").setLevel(Level.DEBUG);

Using the following imports:
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.LoggerContext;

If anyone knows how to do it for the rootLogger, please let me know (as it 
can be annoying to enable debug logs for every package of the 
dependencies...).

Best regards

Andrew

-----Original Message----- 
From: juminoz
Sent: Tuesday, December 13, 2011 12:14 AM
To: logback-user at qos.ch
Subject: [logback-user] Enable Debugging Mode Programmatically?


I was wondering if there is a way to enable debug mode programmatically.
Since I'm not allowed to use configuration file, I'm currently configure
everything programmatically. Recently, I ran into an issue where
RollingFileAppender stop writing to file though FileAppender works perfectly
fine. In fact, RollingFileAppender was also working last week and nothing
that I'm aware of has changed since.

Please let me know if there is a way to enable debug since doing it using
configuration file (logback.xml) doesn't seem to be working.

Thanks,
Jack
-- 
View this message in context: 
http://old.nabble.com/Enable-Debugging-Mode-Programmatically--tp32961424p32961424.html
Sent from the Logback User mailing list archive at Nabble.com.

_______________________________________________
Logback-user mailing list
Logback-user at qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user 



More information about the Logback-user mailing list