[logback-user] Adding a timestamp to a FileAppender file
listid at qos.ch
Thu Oct 30 12:06:35 CET 2008
Have a look at
You would need to write
FileAppender<Object> appender = new FileAppender<Object>();
FileAppender<LoggingEvent> appender = new FileAppender<LoggingEvent>();
You would probably also want to attach the appender you just created to a
logger, possibly as
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
ch.qos.logback.classic.Logger rootLogbackLogger =
rootLogbackLogger.addAppender(the file appender you just created);
Also, the file appender should be attached to logback's logger context.
You should modify the test case, from
Holler if you need further info,
nicolas.giraud at bnf.fr wrote:
> Thanks for the answer, Hannes.
> However a time-based rollover is not what I am looking for. My program
> executes one job at a time. There are several jobs whose duration
> varies from a couple of seconds to several hours. I simply want to log
> the results of a job in a single file, and have the filename contain a
> I will have to do this programmatically obviously, but I'm having
> trouble setting up the file appender programmatically.
Logback: The reliable, generic, fast and flexible logging framework for Java.
More information about the Logback-user