For some reason, the timestamp in my Tomcat logs is off. The system clock is correct, and set to PST, but the Tomcat logs appear to be using GMT. I haven't been able to find this setting anywhere...hoping someone can shed some light.
Thanks
For some reason, the timestamp in my Tomcat logs is off. The system clock is correct, and set to PST, but the Tomcat logs appear to be using GMT. I haven't been able to find this setting anywhere...hoping someone can shed some light.
Thanks
The JVM
might have the wrong timezone set as a default.
Add a JVM
option -Duser.timezone=US/Pacific
(use the JAVA_OPTS
property)
(also do a ps | grep java
to look at the JVM
command line and see if this option is already set for UTC
, perhaps by a configuration setting or environment variable).
Most logging systems default to UTC. This keeps them readable across timezones.
It also allows you to mix logs from different timezones where applicable.
Has the timezone of the system changed since Tomcat was started? I've had problems where Tomcat picks up the timezone when it first starts, and then refuses to accept a new reality until you kill it and start again.
Java has its own implementation of the tzdata
.
For instance, in my ubuntu servers, java's timezone definitions are in /usr/lib/jvm/java-6-sun-1.6.0.14/jre/lib/zi
While the system one are under /usr/share/zoneinfo/
You can specify which timezone java should use by passing the option -Duser.timezone=$TZ
where $TZ
is the relative path to the timezone file under zi
for example: -Duser.timezone=Etc/GMT+3
It appears that Java uses the value in /etc/sysconfig/clock
as the timezone value when starting up. On my system that was:
ZONE="America/New_York"
Change that value to what you want and restart tomcat.
I had a similar problem due to -Duser.timezone=UTC
You can expose this out with ps -edf | grep catalina
if using Linux
I fixed my issue in Tomcat 9 by updating the tzdata-java
package and restarting Tomcat.
yum update tzdata-java
./shutdown.sh
./startup.sh