I have enabled Jetty Access Logs in production and things were going great, until today. Today the access logs appear to no longer be taking data, even though the service itself is running without incident. I suspect there is something I don’t understand about the “retainDays” property. Here is the excerpt from etc/jetty.xml that sets up the logging…
<!-- Built-in Jetty AccessLog log -->
<Ref id="AccessLog">
<Set name="requestLog">
<New id="RequestLogImpl" class="org.eclipse.jetty.server.NCSARequestLog">
<Arg><SystemProperty name="jetty.logs" default="/data/logs"/>/dm-app1_access.log</Arg>
<Set name="retainDays">7</Set>
<Set name="append">true</Set>
<Set name="extended">false</Set>
<Set name="logLatency">true</Set>
<Set name="LogTimeZone">GMT</Set>
</New>
</Set>
</Ref>
Why did logging seemingly stop when this kid hit the retainDays value? I expected it to just truncate and continue on logging to /data/logs/dm-app1_access.log.
The logging stopped because my filename did not include the “yyyy_mm_dd” placeholder. The configuration found to work complete with a logfile naming format similar how we have our logback RollingFileAppenders going is like…
…this gets access logfiles created like logs/access.20120718.log. The big learning moment came when I figured out that ‘yyyy_mm_dd’ in the “filename” property is just a placeholder for the actual SimpleDateFormat contained in the “filenameDateFormat” property.