
Hello, I am new to logback. I am migrating my project from log4j to logback. My question is How to get list of configured loggers into one object? Current code using log4j: Logger rootLogger =Logger.getRootLogger(); LoggerRepository currentRepository = rootLogger.getLoggerRepository(); currentRepository.resetConfiguration(); How i can use the same in logback? Thanks in Advance. Regards, Reddy -- View this message in context: http://logback.10977.n7.nabble.com/How-to-get-list-of-configured-loggers-tp1... Sent from the Users mailing list archive at Nabble.com.

Hi Reddy, The logback/slf4j equivalent would be: import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ch.qos.logback.classic.LoggerContext; LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); context.reset(); See also http://logback.qos.ch/manual/configuration.html I hope this helps, On 04.06.2013 09:06, Govardhana wrote:
Hello,
I am new to logback. I am migrating my project from log4j to logback. My question is How to get list of configured loggers into one object?
Current code using log4j: Logger rootLogger =Logger.getRootLogger(); LoggerRepository currentRepository = rootLogger.getLoggerRepository(); currentRepository.resetConfiguration();
How i can use the same in logback?
Thanks in Advance.
Regards, Reddy
-- View this message in context: http://logback.10977.n7.nabble.com/How-to-get-list-of-configured-loggers-tp1... Sent from the Users mailing list archive at Nabble.com. _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
-- Ceki 65% of statistics are made up on the spot

Hi Ceki, Thanks for quick response! whether we will get the loggers info of provided logger (logback.xml) or some other also ? Another question: below snippet by using Log4j: DOMConfigurator config = new DOMConfigurator(); config.doConfigure(LogUtil.class.getResourceAsStream( //log4j.xml ), //org.apache.log4j.Hierarchy ); By using logback , i can use "JoranConfigurator" or any other..please suggest. Regards, Govardhana -- View this message in context: http://logback.10977.n7.nabble.com/How-to-get-list-of-configured-loggers-tp1... Sent from the Users mailing list archive at Nabble.com.

hi govardhana , {code} DOMConfigurator config = new DOMConfigurator(); config.doConfigure(LogUtil.class.getResourceAsStream( //log4j.xml ), //org.apache.log4j.Hierarchy ); {code} this code is used to initialize log4j.xml, to initilize logback.xml just put your logback.xml on claspath , it will be aoutomatically configured. Cheers praveen On Tue, Jun 4, 2013 at 1:03 PM, Govardhana <jgovardhana@gmail.com> wrote:
Hi Ceki,
Thanks for quick response!
whether we will get the loggers info of provided logger (logback.xml) or some other also ?
Another question: below snippet by using Log4j: DOMConfigurator config = new DOMConfigurator(); config.doConfigure(LogUtil.class.getResourceAsStream( //log4j.xml ), //org.apache.log4j.Hierarchy );
By using logback , i can use "JoranConfigurator" or any other..please suggest.
Regards, Govardhana
-- View this message in context: http://logback.10977.n7.nabble.com/How-to-get-list-of-configured-loggers-tp1... Sent from the Users mailing list archive at Nabble.com. _______________________________________________ Logback-user mailing list Logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user
participants (3)
-
ceki
-
Govardhana
-
praveen patil