I'm using Jetty 8 and am configuring my jetty.xml to customise the requests.log files.
My problem is, Jetty is serving the logs with a timestamp in the GMT timezone - I'm in the UK but its now summer time (GMT+1, aka, BST). Probably because of:
<Set name="LogTimeZone">GMT</Set>
How do I get Jetty to serve the logs using whatever the local time on the server is (which is correct)?
Simply removing the <Set name="LogTimeZone">GMT</Set>
didn't do anything, and I don't want to have to manually change it every 6ish months.
Thanks
The Jetty NCSARequestLog uses java.util.TimeZone.
GMT
is the default for NCSA formatted log files, as this is what various log analysis tools expects.
It sounds like you want the NCSA formatted logs to use a timezone that is daylight savings aware. In that case you have really 1 choice, use the long format Timezone appropriate for your system and environment.
Here's the details about London, England: http://www.timeanddate.com/worldclock/city.html?n=136
What you need is a TimeZone string that will identified by your system. Which means:
- TimeZone identifier does not use GMT offset notation
- TimeZone identifier is not 3-letters (see javadoc section about "Three-letter time zone IDs")
- TimeZone identifier is long form.
Create a simple Java source file and run (on your system) the following code.
package time;
import java.util.TimeZone;
public class TZDump
{
public static void main(String[] args)
{
TimeZone mytz = TimeZone.getDefault();
System.out.printf("The TimeZone for this machine: %s%n", mytz);
for (String string : TimeZone.getAvailableIDs(mytz.getRawOffset())) {
System.out.println(string);
}
}
}
So for my machine, this reports ...
SystemV/MST7MDT
US/Arizona
US/Mountain
I'm lucky, as this is list is small, and a bonus for me is that where I live Daylights Savings Time is not observed. In my case, I'll use "US/Arizona"
.
In your case, you'll see a larger list (just because you are so close to Europe).
Choose an entry that starts with "Europe/"
(I'm guessing yours will be "Europe/London"
)
Now use that long form TimeZone identifier in your configuration.
<Set name="LogTimeZone">Europe/London</Set>