<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>I am using Logback to create a daily rolling log file. It does rename the existing log file and creates a new one, however it is not doing it correctly (or I am telling something incorrectly). Below is the logback.xml file I am using:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-left:.5in'><b><span style='font-size:10.0pt;font-family:"Courier New";color:#FF6600'><?xml version="1.0" encoding="UTF-8"?><br></span></b><b><span style='font-size:10.0pt;font-family:"Courier New";color:purple'><configuration></span></b><span style='font-size:10.0pt;font-family:"Courier New"'><br> <b><span style='color:purple'><timestamp</span><span style='color:#A00000'> key</span><span style='color:teal'>=</span><span style='color:blue'>"today"</span><span style='color:#A00000'> datePattern</span><span style='color:teal'>=</span><span style='color:blue'>"yyyyMMdd"</span><span style='color:purple'>/></span></b><br><br> <b><span style='color:purple'><appender</span><span style='color:#A00000'> name</span><span style='color:teal'>=</span><span style='color:blue'>"ScreenAppender"</span><span style='color:#A00000'> class</span><span style='color:teal'>=</span><span style='color:blue'>"ch.qos.logback.core.ConsoleAppender"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><filter</span><span style='color:#A00000'> class</span><span style='color:teal'>=</span><span style='color:blue'>"ch.qos.logback.classic.filter.ThresholdFilter"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><level></span></b>debug<b><span style='color:purple'></level></span></b><br> <b><span style='color:purple'></filter></span></b><br> <b><span style='color:purple'><encoder></span></b><br> <b><span style='color:purple'><pattern></span></b>%date{HH:mm:ss.SSS} %-5level %logger{20} [%file:%line] - %msg%n<b><span style='color:purple'></pattern></span></b><br> <b><span style='color:purple'></encoder></span></b><br> <b><span style='color:purple'></appender></span></b><br><br> <b><span style='color:purple'><appender</span><span style='color:#A00000'> name</span><span style='color:teal'>=</span><span style='color:blue'>"UpdateAppender"</span><span style='color:#A00000'> class</span><span style='color:teal'>=</span><span style='color:blue'>"ch.qos.logback.core.rolling.RollingFileAppender"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><append></span></b>true<b><span style='color:purple'></append></span></b><br> <b><span style='color:purple'><filter</span><span style='color:#A00000'> class</span><span style='color:teal'>=</span><span style='color:blue'>"ch.qos.logback.classic.filter.ThresholdFilter"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><level></span></b>info<b><span style='color:purple'></level></span></b><br> <b><span style='color:purple'></filter></span></b><br> <b><span style='color:purple'><file></span></b>${CATALINA_HOME}/logs/update-server.log<b><span style='color:purple'></file></span></b><br> <b><span style='color:purple'><encoder></span></b><br> <b><span style='color:purple'><pattern></span></b>%date{HH:mm:ss.SSS} %-5level %logger{40} [%file:%line] - %msg%n<b><span style='color:purple'></pattern></span></b><br> <b><span style='color:purple'></encoder></span></b><br> <b><span style='color:purple'><rollingPolicy</span><span style='color:#A00000'> class</span><span style='color:teal'>=</span><span style='color:blue'>"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><fileNamePattern></span></b>update-server.%d{yyyy-MM-dd}.zip<b><span style='color:purple'></fileNamePattern></span></b><br> <b><span style='color:purple'><maxHistory></span></b>180<b><span style='color:purple'></maxHistory></span></b><br> <b><span style='color:purple'></rollingPolicy></span></b><br> <b><span style='color:purple'></appender></span></b><br><br> <b><span style='color:purple'><root</span><span style='color:#A00000'> level</span><span style='color:teal'>=</span><span style='color:blue'>"debug"</span><span style='color:purple'>></span></b><br> <b><span style='color:purple'><appender-ref</span><span style='color:#A00000'> ref</span><span style='color:teal'>=</span><span style='color:blue'>"ScreenAppender"</span><span style='color:purple'>/></span></b><br> <b><span style='color:purple'><appender-ref</span><span style='color:#A00000'> ref</span><span style='color:teal'>=</span><span style='color:blue'>"UpdateAppender"</span><span style='color:purple'>/></span></b><br> <b><span style='color:purple'></root></span></b><br><b><span style='color:purple'></configuration></span></b></span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The log file does get created as update-server.log. And when the day rolls over, the next generated message for logging does result in that log file being renamed, but not as I expect it to. The resulting name is update-server.log1161295506996864.tmp. And, the file itself is not ZIPped, just renamed.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I would expect the file to be named update-server.20120103.log and to have that file ZIPped. Does anyone know why?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>As a second (minor) issue, I would like the original log file to be called update-server-YYYYMMDD.log, but when I tried to do that, the log file created stays the same and at midnight, the file is overwritten. I used the line below, but it appears that Logback does not increment the ${today} value:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'> <b><span style='color:purple'><file></span></b>${CATALINA_HOME}/logs/update-server-${today}.log<b><span style='color:purple'></file></span></b><br><br></span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:#364395'>Mike Viens<br></span></b><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Sr. Software Engineer<br>K-12 Technology<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><br>10911 White Rock Road, Suite 100</span><span style='font-size:7.5pt;font-family:"Verdana","sans-serif"'> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>Rancho Cordova, CA 95670<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>D: (916)288-1651</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>M: (916)524-3663</span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'>E: <a href="mailto:michael.viens@pearson.com"><span style='color:blue'>mike.viens@pearson.com</span></a></span><o:p></o:p></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Verdana","sans-serif"'><br><b><span style='color:#364395'>Pearson <br></span></b><span style='color:#364395'>Always Learning<br>Learn more at </span></span><span style='font-size:7.5pt;color:#364395'><a href="http://www.pearsonschoolsystems.com/"><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";color:blue'>www.pearsonschoolsystems.com</span></a></span><o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>