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] [Commented] (LOG4J2-1074) Add a logformat token for nanotime
Date Sun, 12 Jul 2015 06:21:04 GMT

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

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

While working on this issue, an interesting practical consideration came up: the impact of
the new field on the constructors. {{Log4jLogEvent}} already has 5 public constructors and
a factory method. To ensure backwards compatibility I could duplicate all these constructors
with an additional {{nanoTime}} parameter but that feels silly. On the other hand, modifying
the existing constructors to simply add a nanoTime parameter requires many JUnit tests to
be modified.

I am taking this opportunity to improve the existing {{Log4jLogEvent.Builder}} and use this
to create log events as much as possible. Especially JUnit tests will be much less impacted
by future changes to Log4jLogEvent.

I will reduce the internal dependence on the constructors and factory method and deprecate
the ones that end up without references. I may still need to add one or two public constructors
but will try to keep it to a minimum.

> 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
>            Assignee: Remko Popma
>
> 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


Mime
View raw message