[logback-user] rolling log files

ceki ceki at qos.ch
Fri Jul 6 00:39:29 CEST 2012


Hello J.V.,

You can have a secondary date token in the file name pattern. Example:

<appender name="FILE"
           class="ch.qos.logback.core.rolling.RollingFileAppender">
   <file>logFile.log</file>
     <rollingPolicy
            class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
       <!--daily rollover,
           but with timestamp including hour and minute-->
       <fileNamePattern>
              logFile.%d{yyyy-MM-dd}T%d{HH_mm,aux}.log
       </fileNamePattern>
     </rollingPolicy
</appender>


See also the docs at [1] in particular the 'aux' parameter for
fileNamePattern.

I hope this helps,

-- 
Ceki
http://twitter.com/#!/ceki

[1] http://logback.qos.ch/manual/appenders.html#TimeBasedRollingPolicy

On 05.07.2012 22:10, J.V. wrote:
> I want to set 'append=false' but have each log file created have a
> timestamp of the creation in the name so as to not overwrite previous
> log files.
>
> How is this accomplished (if possible at all)?
>
> thanks
>
> J.V.





More information about the Logback-user mailing list