logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Elapsed time: Can I reset?
Date Thu, 24 Apr 2003 05:52:43 GMT

Hi Paul,

Actually this is the first time such a request has been made. There is no 
"hidden" way to enable this feature. I am afraid you will have to write 
some code.

A setter method for startTime in the o.a.l.spi.LoggingEvent class should do 
it. Setting the startTime will have log4j-wide effects. For example,  the 
relative time computation of all layouts will be affected.

Here is the code:

public class LoggingEvent implements java.io.Serializable {

   ... as before

   public static void setStartTime(long newStartTime) {
     return startTime = newStartTime;

In your code, you would then call LoggingEvent.setStartTime(some value);

I hope this answers your question.

At 04:50 PM 4/23/2003 -0700, you wrote:
>I've just joined this list, so forgive newbie errors and insensitivities...
>Is there an *easy* way to set the "origin" of the time stamp used in the log
>entries?  That is, I'd like to have a log start marking time from some
>number of milliseconds rather than zero.  I'd prefer not to have to write
>and/or modify an appender.  I'm hoping that this is a commonly-enough
>requested feature that it's already "in there," but hidden from me  :)

Ceki  For log4j documentation consider "The complete log4j manual"

To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org

View raw message