You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Remko Popma (JIRA)" <ji...@apache.org> on 2016/03/30 16:56:25 UTC

[jira] [Closed] (LOG4J2-1339) AsyncLogger should not call instanceof TimestampMessage in hot path

     [ https://issues.apache.org/jira/browse/LOG4J2-1339?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Remko Popma closed LOG4J2-1339.
-------------------------------

> AsyncLogger should not call instanceof TimestampMessage in hot path
> -------------------------------------------------------------------
>
>                 Key: LOG4J2-1339
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1339
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.1, 2.0.2, 2.1, 2.2, 2.3, 2.4, 2.4.1, 2.5
>            Reporter: Remko Popma
>            Assignee: Remko Popma
>             Fix For: 2.6
>
>
> With LOG4J2-744, AsyncLogger attempts to get the time from the message by calling
> {code}
> millis = message instanceof TimestampMessage ? ((TimestampMessage) message).getTimestamp() : CLOCK.currentTimeMillis()
> {code}
> for every message. The vast majority of messages are not TimestampMessages so the time is eventually obtained from the clock. However, benchmarking shows that the {{instanceof}} check is not free.
> It gives better performance to postpone the above logic to the background thread.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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