
Hello Neil, It might be useful to know that if you don't specify the <file> property for RollingFileAppender, then the DateBasedRollingPolicy (but not FixedWindowRollingPolicy) will set the name of the active log file as computed by the value of <FileNamePattern> *and* the current date. Coming back your question, there is no way to vary the file name as specified by the <file> property. There is already issue LBCORE-68 related to the same topic. You are welcome to vote on it. Your second question about the timezone for the %d converter, please enter a jira issue, as if my memory serves me correctly, there is no way to set the timezone for this parameter. Neil Lott wrote:
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
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch