Frank, I know this has come up a lot in the past, and I think it should be addressed. I don't know if there are any plans in 1.3 related to PatternLayout/PatternParser that might allow this in a different/better way.
If you have a patch you have been testing, please post it to this or the log4j-dev list for evaluation. Not super familiar with that part of the code, but I think your solution/suggestion has merit and should be looked at closer. -Mark > -----Original Message----- > From: Frank Hood [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 26, 2002 2:57 PM > To: [EMAIL PROTECTED] > Subject: Time Zones > > > 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]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>