This is in reply to unanswered questions about changing time zones for the 
date-time output.

I spent some time looking into this.  Short answer is: can't do 
it.  But...PatternParser parses the PatternLayout string, finds the %d, 
checks for ABSOLUTE, DATE, and ISO8601.  It then calls the similarly named 
class to format date outputs.  Now each of these classes has a constructor 
that takes a timeZone as an argument, but of course that constructor is not 
called, just the no argument constructor that uses 
Calendar.getInstance().  So one fix is to recode that section of 
PatternParser to call the alternate constructor.

I can see why this hasn't been done.  To parse for a valid time-zone value 
in addition to the aforementioned string can get difficult.  My best idea 
so far is adding a new key letter to the PatternLayout for the parser to 
look for--one representing the time-zone, and then call the setTimeZone 
method on the DateFormat (df) field.  It seems to work, although I'm not 
really familiar with the log4j code, so I could be missing something.

BTW, this has become a very busy list, and subscribing to it causes my 
mailbox great strain.  I don't mind registering in order to post, but 
subscribing seems a little much.  I suspect some people unsubscribe and 
then read it anyway, replying to people when they can help.  Someone did 
that for me and my question about the Mapped Diagnostic Context.  It helped 
me, but didn't help anyone else out there on the log4j-user list.  Anyone 
else think this is a problem?



Frank L. Hood


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to