logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remko Popma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4J2-455) RingBufferLogEvent should use Messsage timestamp first
Date Sun, 22 Dec 2013 14:10:55 GMT

    [ https://issues.apache.org/jira/browse/LOG4J2-455?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13855176#comment-13855176

Remko Popma commented on LOG4J2-455:

That is an option but would entail an API change: adding the method getTimestamp to the Message
interface in the api module.

I don't mind making the suggested change (and avoiding the API change).
I just want to do some performance testing: It is possible that (instanceof + method invocation
on message) is faster than the call to clock.currentTimeMillis().
If that is the case I'll do this in the calling application thread, otherwise in the background
logging thread. Either will solve Robin's issue.

> RingBufferLogEvent should use Messsage timestamp first
> ------------------------------------------------------
>                 Key: LOG4J2-455
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-455
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 2.0-beta9
>            Reporter: robin zhang tao
> When AsyncLogger received log message (method 
> {code}
>  public void log(final Marker marker, final String fqcn, final Level level, final Message
>             final Throwable t)
> {code}
> ), currently it uses  
> {code}
> clock.currentTimeMillis()
> {code}
>  (see at Line 221) as the timestamp.
> But it should check the message implements TimestampMessage or not, if yes, should use
TimestampMessage.getTimestamp() as the timestamp, if not , then using clock.currentTimeMillis().

> The new Code:
> {code}
> data instanceof TimestampMessage ? ((TimestampMessage) data ).getTimestamp() : clock.currentTimeMillis();
> {code}

This message was sent by Atlassian JIRA

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

View raw message