logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Sheldon <KShel...@slb.com>
Subject how to create a unique log file name for each run of a program
Date Tue, 03 Aug 2010 15:06:11 GMT
I would like each run f the application to start a new log file. I would like the application
log file to be unique.
Is it possible with the log4cxx DOMConfigurator to create a file name based on the current
date and time?

In log4net, this would be accomplished with something like this:

  <appender name="MyAppender" type="log4net.Appender.FileAppender">
    <file type="log4net.Util.PatternString" value="logs\MyAppName_%date{yyyyMMdd-HHmmss}.log"
    <appendToFile value="false"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%date %-5level %logger [%property{NDC}] - %message%n"/>

View raw message