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/08/22 15:25:45 UTC
[jira] [Resolved] (LOG4J2-812) Performance optimization: avoid use of synchronized SimpleDateFormat in DatePatternConverter
[ https://issues.apache.org/jira/browse/LOG4J2-812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Remko Popma resolved LOG4J2-812.
--------------------------------
Resolution: Fixed
Fix Version/s: (was: 2.3)
2.4
Marking this issue as resolved since Ralph added most of the work for this to git master in commit 051f7019.
I will create a separate Jira issue to track the remaining work.
Please verify and close.
> Performance optimization: avoid use of synchronized SimpleDateFormat in DatePatternConverter
> -----------------------------------------------------------------------------------------------
>
> 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: Ralph Goers
> Fix For: 2.4
>
> Attachments: LOG4J2-812-patch.txt, LOG4J2-812.patch2.diff, LOG4J2-812.patch3.diff
>
>
> Threads seem to be blocking on class org.apache.loggin.log4j.core.pattern.DatePatternConverter. 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