[ 
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 data,
>             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
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to