|-INFO in ch.qos.logback.classic.BasicConfigurator@6f7a6e - Setting up default configuration.
|-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - Ignoring debug attribute.
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [STDOUT] from the object stack
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.FileAppender]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
|-INFO in ch.qos.logback.core.joran.action.AppenderAction - Popping appender named [FILE] from the object stack
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - milan level set to INFO
|-INFO in ch.qos.logback.classic.joran.action.LevelAction - root level set to DEBUG
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[root]
|-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[root]
but no testFile.log is written
moreover, I use the code :
// logback
String chemin = getServletContext().getRealPath("/"); ;
String file = chemin + "logback.xml";
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
try {
JoranConfigurator configurator = new JoranConfigurator();
configurator.setContext(lc);
lc.shutdownAndReset();
configurator.doConfigure(file);
} catch (JoranException je) {
StatusPrinter.print(lc);
} finally {
StatusPrinter.print(lc);
}
MDC.put("host", "");
logger = LoggerFactory.getLogger(this.getClass());
ch.qos.logback.classic.Logger log1 = lc.getLogger(this.getClass());
//logger.debug (log1.getName());
System.out.println (log1.getName());
ch.qos.logback.core.Appender app1 = log1.getAppender("STDOUT");
if (app1 !=null) {
ch.qos.logback.core.Layout lay1 = app1.getLayout();
logger.debug(lay1.getContentType());
}
I can retreive the name of my logger but I cannot retrieve the Appender object
why ?
thanks