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:33:25 UTC
[jira] [Created] (LOG4J2-1339) AsyncLogger should not call
instanceof TimestampMessage in hot path
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