logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-812) Performance optimization: avoid use of synchronized SimpleDateFormat in Dat​ePatternCo​nverter
Date Sat, 11 Jul 2015 20:27:04 GMT

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

Gary Gregory edited comment on LOG4J2-812 at 7/11/15 8:26 PM:
--------------------------------------------------------------

I addressed:

{quote}
- Fix the message Could not instantiate SimpleDateFormat with pattern to mention FastDateFormat.
- I would make ivars and params like timestamp and time specify their scale, for example timestampMillis
vs. timestampNanos.
- Make everything final that can be final.
{quote}

Remains:

{quote}
- Make comments like "Copied from Commons Lang 3" more specific, for example: "Copied from
Commons Lang 3.4 tag http://..." or "Copied from Commons Lang 3.4 Git revision xxx". This
will allow maintainers to know when it might make sense to look for updating the code from
Commons Lang again.
- Pick up the latest sources from Apache Commons Lang for FastDate classes and document per
above. I propose we document provenance next to the sources in the package, in a package comment,
this would let the only change be in the package decl. The less fiddling the better.
{quote}


was (Author: garydgregory):
I addressed:

{quote}
- Fix the message Could not instantiate SimpleDateFormat with pattern to mention FastDateFormat.
- I would make ivars and params like timestamp and time specify their scale, for example timestampMillis
vs. timestampNanos.
- Make everything final that can be final.
{quote}

Remains:

{quote}
- Make comments like "Copied from Commons Lang 3" more specific, for example: "Copied from
Commons Lang 3.4 tag http://..." or "Copied from Commons Lang 3.4 Git revision xxx". This
will allow maintainers to know when it might make sense to look for updating the code from
Commons Lang again.
- Pick up the latest sources from Apache Commons Lang for FastDate classes.
{quote}

> Performance optimization: avoid use of synchronized SimpleDateFormat in Dat​ePatternCo​nverter

> -----------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-812
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-812
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Pattern Converters, Performance Benchmarks
>    Affects Versions: 2.0.2
>            Reporter: Mohit Anchlia
>            Assignee: Remko Popma
>             Fix For: 2.3
>
>         Attachments: LOG4J2-812-patch.txt, LOG4J2-812.patch2.diff, LOG4J2-812.patch3.diff
>
>
> Threads seem to be blocking on class org.apache​.loggin.lo​g4j.core.p​attern.Dat​ePatternCo​nverter.
It's short lived but is visible in profiler. It also is adding on to CPU. Here is the mail
conversation on the mailing list:
> {quote}
> Ralph Goers ralph.goers@dslextreme.com via logging.apache.org  
> The converter uses a SimpleDateFormat which is not thread safe and so is synchronized.
I am sure there might be minor optimizations that could be done to this
>  What I would do is modify DatePatternConverter to
>  a) use Java 8’s java.time.format.DateTimeFormatter if running on Java 8
>  b) use Joda Time’s DateTimeFormat if it is present.
>  c) create a pool of SimpleDateFormat objects and use those.
>  Please create a Jira issue for this.
>  Ralph
> {quote}
> ----
> One alternative that  was suggested on the mailing list is to use commons lang FastDateFormat
to format log timestamps.



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