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 2015/07/05 10:27:05 UTC

[jira] [Commented] (LOG4J2-1074) Add a logformat token for nanotime

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

Remko Popma commented on LOG4J2-1074:
-------------------------------------

Hi Will, I just realized that the log format specifier will be invoked at the time the Layout is invoked by the Appender. So for asynchronous logging (where the Appender is called in a background thread) this may not be what you want (if you are using Log4j as a benchmarking tool). 

To remedy this we would need to carry a nanoTime field in the LogEvent, and either always initialize it or only initialize it if it is used downstream by one of the Appenders. This last option may be tricky to implement...

> Add a logformat token for nanotime
> ----------------------------------
>
>                 Key: LOG4J2-1074
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1074
>             Project: Log4j 2
>          Issue Type: New Feature
>            Reporter: Will Hains
>
> Add a token in the log format specifier to output the current value of {{System.nanotime()}}.
> We are currently adding the nanotime value to our log messages manually, which we find very useful for troubleshooting unexpected latency, and as a quick-and-dirty data source to feed into performance analysis tools.
> It would be very nice if Log4j could do this for us. It would also be nice to have this in the log format specified, so we can turn it on/off at runtime by editing the Log4j config file.



--
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