File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Oracle/OAS and the fly likes log4j date & time running in embedded oc4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "log4j date & time running in embedded oc4j" Watch "log4j date & time running in embedded oc4j" New topic

log4j date & time running in embedded oc4j

louise rochford
Ranch Hand

Joined: Apr 04, 2002
Posts: 119
The date & time on my logs produced via log4j are as at UTC, rather than local time. Since I'm running from a location UTC+12 this is really confusing output.
e.g. each log line starts:
2011-05-12 22:01:04,657 DEBUG ...
when it should be:
2011-05-13 10:01:04,657 DEBUG ...

It only seems to effect logs produced running the embedded OC4J - or at least the start up log for the standalone OC4j is in the correct timezone.
I've tried comparing various config & log files from the standalone directories with the embedded directories butt hat hasn't turned up anything likely.
It is picking up the date & time from the pc - I've tried changing the pc date & that gets 'reflected' in the log date - but isn't correct.
Seems to effect the logs for all apps I'm running in jDeveloper on my pc.
Note that the same apps run on other peoples pcs work fine. I'm the only one on Windows 7 so far though.

Any ideas? Trivial but driving me nuts.
Think it might just be doing it to remind me I'm a Brit working in New Zealand...
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Louise,

According to API doc you can do this.

d : Used to output the date of the logging event. The date conversion specifier may be followed by a set of braces containing a date and time pattern strings SimpleDateFormat, ABSOLUTE, DATE or ISO8601 and a set of braces containing a time zone id per TimeZone.getTimeZone(String). For example, %d{HH:mm:ss,SSS}, %d{dd MMM yyyy HH:mm:ss,SSS}, %d{DATE} or %d{HH:mm:ss}{GMT+0}. If no date format specifier is given then ISO8601 format is assumed.

You may find the reference here.
I agree. Here's the link:
subject: log4j date & time running in embedded oc4j
It's not a secret anymore!