You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Rowe, Ciaran (IT)" <Ci...@morganstanley.com> on 2009/05/08 14:04:49 UTC

Tomcat logs in EST, webapp reports time in GMT

Hi All,

I'm not so experienced in how Java/Tomcat handle timezone matters, but I've come across a running instance of a container which claims to be in GMT for some webapps, and US/Eastern for others.

The container itself appears to be logging in US/Eastern.

I've verified through a heapdump that there are various GregorianCalendar instances floating around memory with different ZoneInfo instances (some ID themselves as GMT, some as US/Eastern).

Nowhere in the app code makes a clear request to have the time in GMT, everything uses the default, so they should all report in US/Eastern.  I'm wondering what settings/behaviours in tomcat/the JVM could effect a default timezone change for an application?

Could the GregorianCalendar object itself be working some voodoo on this? Why isn't everything picking up EDT as the timezone?

Any insights appreciated.

Thanks,
Ciarán


--------------------------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error. Morgan Stanley may monitor and store emails to the extent permitted by applicable law.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat logs in EST, webapp reports time in GMT

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ciarán,

On 5/8/2009 8:04 AM, Rowe, Ciaran (IT) wrote:
> I'm not so experienced in how Java/Tomcat handle timezone matters,
> but I've come across a running instance of a container which claims
> to be in GMT for some webapps, and US/Eastern for others.

What is the time zone of the running JVM? You can check the value of the
"user.timezone" system propery, or just call
java.util.TimeZone.getDefault().

> The container itself appears to be logging in US/Eastern.

This is most likely the default for the JVM.

> I've verified through a heapdump that there are various
> GregorianCalendar instances floating around memory with different
> ZoneInfo instances (some ID themselves as GMT, some as US/Eastern).

With a heap dump, it will be tough to determine who is using what. You
might want to turn to a debugger.

> Nowhere in the app code makes a clear request to have the time in
> GMT, everything uses the default, so they should all report in
> US/Eastern.  I'm wondering what settings/behaviours in tomcat/the JVM
> could effect a default timezone change for an application?

When you say the "webapp is reporting times in GMT", do you mean times
displayed in web pages generated by the webapp? Or do you mean web app
logs or something? I'm wondering if the webapp is sniffing the time zone
from the client (browser) and adjusting the time zone for that user. Or,
maybe there's a user preference or something that doesn't allow you to
do a simple grep through your code for "GMT".

> Could the GregorianCalendar object itself be working some voodoo on
> this? Why isn't everything picking up EDT as the timezone?

I couldn't guess, but I would find everywhere in your application where
you use Calendar or TimeZone. I'd also look at how you render times in
your pages... if you are using some kind of JSP tag library or something
to display dates, it might be either misconfigured, or using information
you didn't expect to determine the time zone.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkoImRIACgkQ9CaO5/Lv0PBvmgCfb3TNYzYgB6fLTPSGqDwA7td9
zhsAn0hWDM/qOALYftG2uINWFUTs734u
=+dhz
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org