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] [Created] (LOG4J2-1339) AsyncLogger should not call instanceof TimestampMessage in hot path
Date Wed, 30 Mar 2016 14:33:25 GMT
Remko Popma created LOG4J2-1339:
-----------------------------------

             Summary: 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.5, 2.4.1, 2.4, 2.3, 2.2, 2.1, 2.0.2, 2.0.1
            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


Mime
View raw message