log4j and Timezones - help!

Discussion in 'Java' started by sarah.wilson@cpp.co.uk, Feb 10, 2005.

  1. Guest

    I am using log4j and would like configure my appenders with a timezone.
    I want to write the same log information to two logs:
    a) LOG1 has a formatted timestamp in UK time (GMT) followed by the
    message
    b) LOG2 has a formatted timestamp in US time followed by the message

    My messages are currently coming out in UK time.

    I am new to java.
    Can anyone suggest the best way to do this? I think I need to extend
    PatternLayout in some way but don't know where to start.

    Thanks alot for your help
    , Feb 10, 2005
    #1
    1. Advertising

  2. Rhino Guest

    <> wrote in message
    news:...
    > I am using log4j and would like configure my appenders with a timezone.
    > I want to write the same log information to two logs:
    > a) LOG1 has a formatted timestamp in UK time (GMT) followed by the
    > message
    > b) LOG2 has a formatted timestamp in US time followed by the message
    >
    > My messages are currently coming out in UK time.
    >
    > I am new to java.
    > Can anyone suggest the best way to do this? I think I need to extend
    > PatternLayout in some way but don't know where to start.
    >
    > Thanks alot for your help
    >

    I don't know anything about log4j but I have a design comment.

    Wouldn't it be better to have a single log with all timestamps using the
    same timezone - which everyone has agreed upon first, if possible - than to
    have multiple logs with timestamps that use different timezones? Otherwise,
    I suspect you're going to run into more confusion down the road as different
    people discuss the same problems but each have different timestamps for the
    same events. For instance, Nigel in the UK says to his colleague Bob in New
    York: "See here Bob, old chap, I have a bit of a sticky wicket at 3:24:17 in
    the log." Bob replies "I don't see nothin' wrong at 3:24:17. But I'm glad
    y'all called 'cuz there's something nasty at 8:24:17 in my log.". Their
    colleague Dave, who is in L.A. and is part of the conference call (and has
    his own log which uses Pacific Standard Time), says "I don't know what you
    dudes are talkin' about; my log shows a bad problem at 11:24:17 but those
    other times are just fine." [Forgive the exaggerated dialog ;-)]

    See my point? If people in different locations each get a log with the same
    events but with the timestamps in their own timezone, it would tend to make
    it harder to collaborate on problems. Or that would be my guess anyway,
    never actually having experienced the situation I'm describing.

    Rhino
    Rhino, Feb 10, 2005
    #2
    1. Advertising

  3. Guest

    fair point.
    We actually have a single clock at the moment (UK time) and this is
    causing confusion with the local support teams who have to adjust from
    GMT mentally before dealing with a problem.
    The US log is for problems which have to be dealt with wholly in the
    US, we will have a Spanish log for Spanish problems etc. (no
    "sticky-wicket y'all" conversations but I like the characterisation!)

    Any transatlantic conversations would involve refering to the central
    log as you suggest. At the moment this is not a likely scenario so I am
    not planning on adding two timestamps to the US log for the moment.
    I'll bear this in mind for the future in the formatter though...
    , Feb 11, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alexandra Stehman

    eclipse, junit, log4j, & finding log4j.xml

    Alexandra Stehman, Jan 19, 2004, in forum: Java
    Replies:
    0
    Views:
    5,771
    Alexandra Stehman
    Jan 19, 2004
  2. Alex Hunsley
    Replies:
    2
    Views:
    12,932
    =?ISO-8859-15?Q?Fr=E9d=E9ric_G=E9din?=
    May 28, 2004
  3. Rodolfo
    Replies:
    0
    Views:
    953
    Rodolfo
    Jul 12, 2004
  4. joes
    Replies:
    1
    Views:
    2,160
  5. Gianni Galore
    Replies:
    0
    Views:
    1,270
    Gianni Galore
    Sep 8, 2010
Loading...

Share This Page