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
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user

Reply via email to