[logback-user] file name question

Neil Lott neilmatthewlott at yahoo.com
Tue Feb 3 06:11:17 CET 2009


Here's my appender snippet.


       <appender name="MSA_LOG"  
class="ch.qos.logback.core.rolling.RollingFileAppender">
         <file>/usr/local/mystro/logs/msa-mdn.log</file>
         <append>true</append>

         <rollingPolicy  
class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
             <FileNamePattern>/usr/local/neil/logs/msa-mdn-%i- 
%d{yyyyMMdd-HHmmss}.log</FileNamePattern>
             <MinIndex>1</MinIndex>
             <MaxIndex>5</MaxIndex>
         </rollingPolicy>

         <triggeringPolicy  
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
             <MaxFileSize>10MB</MaxFileSize>
         </triggeringPolicy>

         <layout class="ch.qos.logback.classic.PatternLayout">
             <Pattern> { %d{yyyyMMdd HHmmss.SSS} %msg \} %n</Pattern>
         </layout>
     </appender>


I'd like to be able to start with a file name pattern for my initial  
file.  Is there a way to do this?  So instead of
msa-mdn.log I'd like to have msa-mdn-0-20090203-042416.log or whatever  
the current time is as my initial file name.

Also, I'd like to %d{yyyyMMdd-HHmmss} to have my date formatted in GMT  
time not local.  How would I go about doing this?

Thanks,

Neil


More information about the Logback-user mailing list