You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Chris Naude <ck...@yahoo.co.uk> on 2002/05/27 21:42:03 UTC

program version in Log4j

Hi

I am trying to get a program version # (or somesort of version identifier) to print as part of my log statements. This would enable me to easily see if I am running the correct program by simply changing the program version identifier. Is there an easy way of doing this in Log4J.

Regards

Chris

 



---------------------------------
Sign up to watch the FIFA World Cup video highlights from your desk!

http://fifaworldcup.yahoo.com/fc/en

Re: program version in Log4j

Posted by Ceki Gülcü <ce...@qos.ch>.
I see. The MDC is what you are looking for.

At 09:52 28.05.2002 +0100, Chris Naude wrote:

>  Ceki
>This is not quite what I meant. I am not really referring to an 
>application version, but rather a string tag that can be set (typically 
>with a different value) at a program level. I find this useful in order to 
>establish that I am running the correct program, and not an older version. 
>So what I would do is change the string tag in a particular program, then 
>if that tag appears in my log statements, I would know for sure that I am 
>running that version of the program. One way of resolving this is to be 
>able to create a conversion pattern like:
>"XYZApp %v %d [%t] %p %c - %m%n"
>
>where v is settable at an individual program level. Every program mustthen 
>have a way of setting the v variable. (probably  a static final)
>
>Is this possible in log4j, or do you have any other way of achieving a 
>similar effect.
>
>Regards
>
>Chris
>
>   Ceki Gülcü <ce...@qos.ch> wrote:
>
>Chris,
>
>If it is appropriate for your application to configure log4j and it
>uses the pattern layout, you can simply include the version in the
>conversion pattern:
>
>as in "XYZApp v3.14 %d [%t] %p %c - %m%n"
>
>At 20:42 27.05.2002 +0100, Chris Naude wrote:
>
> >Hi
> >
> >I am trying to get a program version # (or somesort of version identifier)
> >to print as part of my log statements. This would enable me to easily see
> >if I am running the correct program by simply changing the program version
> >identifier. Is there an easy way of doing this in Log4J.
> >
> >Regards
> >
> >Chris
>
>
>I hope the above is useful.
>
>--
>Ceki
>
>
>--
>To unsubscribe, e-mail:
>For additional commands, e-mail
>
>
>---------------------------------
>Sign up to watch the FIFA World Cup video highlights from your desk!
>
>http://fifaworldcup.yahoo.com/fc/en

--
Ceki


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: program version in Log4j

Posted by Chris Naude <ck...@yahoo.co.uk>.
 Ceki
This is not quite what I meant. I am not really referring to an application version, but rather a string tag that can be set (typically with a different value) at a program level. I find this useful in order to establish that I am running the correct program, and not an older version. So what I would do is change the string tag in a particular program, then if that tag appears in my log statements, I would know for sure that I am running that version of the program. One way of resolving this is to be able to create a conversion pattern like:
"XYZApp %v %d [%t] %p %c - %m%n"

where v is settable at an individual program level. Every program mustthen have a way of setting the v variable. (probably  a static final)

Is this possible in log4j, or do you have any other way of achieving a similar effect.

Regards

Chris

  Ceki Gülcü <ce...@qos.ch> wrote: 

Chris,

If it is appropriate for your application to configure log4j and it
uses the pattern layout, you can simply include the version in the
conversion pattern:

as in "XYZApp v3.14 %d [%t] %p %c - %m%n"

At 20:42 27.05.2002 +0100, Chris Naude wrote:

>Hi
>
>I am trying to get a program version # (or somesort of version identifier) 
>to print as part of my log statements. This would enable me to easily see 
>if I am running the correct program by simply changing the program version 
>identifier. Is there an easy way of doing this in Log4J.
>
>Regards
>
>Chris


I hope the above is useful.

--
Ceki


--
To unsubscribe, e-mail: 
For additional commands, e-mail


---------------------------------
Sign up to watch the FIFA World Cup video highlights from your desk!

http://fifaworldcup.yahoo.com/fc/en

Re: program version in Log4j

Posted by Ceki Gülcü <ce...@qos.ch>.
Chris,

If it is appropriate for your application to configure log4j and it
uses the pattern layout, you can simply include the version in the
conversion pattern:

as in "XYZApp v3.14 %d [%t] %p %c - %m%n"

At 20:42 27.05.2002 +0100, Chris Naude wrote:

>Hi
>
>I am trying to get a program version # (or somesort of version identifier) 
>to print as part of my log statements. This would enable me to easily see 
>if I am running the correct program by simply changing the program version 
>identifier. Is there an easy way of doing this in Log4J.
>
>Regards
>
>Chris


I hope the above is useful.

--
Ceki


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>