[logback-user] about file appender
Berker Batur
berkerbatur at gmail.com
Wed Sep 28 11:00:04 CEST 2011
Hi,
I want to add a file appender to one of my loggers, from the inside of
the code, not from the configuration file.
I successfully append the network appender but the same way did not
work in file appenders.
Here is the code that I tried:
FileAppender<E> myFAppender = new FileAppender<E>();
myFAppender.setFile("myLog.txt");
myFAppender.setName("myFAppender1");
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
myFAppender.setContext(lc);
myFAppender.start()
myLogger.addAppender(myFAppender); <---- this method do not accept
an argument type of FileAppender<E> .
In socket appender, I used ILogging event and it worked well but in
file appender case I did not solve the issue below.
Thanks,
Best Regards,
Berker Batur
More information about the Logback-user
mailing list