Mohit Anchlia (JIRA)
2014-09-03 23:39:51 UTC
Mohit Anchlia created LOG4J2-812:
------------------------------------
Summary: Blocking state: org.apache.loggin.log4j.core.pattern.DatePatternConverter
Key: LOG4J2-812
URL: https://issues.apache.org/jira/browse/LOG4J2-812
Project: Log4j 2
Issue Type: Bug
Affects Versions: 2.0.2
Reporter: Mohit Anchlia
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:
-------------
Ralph Goers ***@dslextreme.com via logging.apache.org
4:28 PM (10 minutes ago)
to Log4J
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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
------------------------------------
Summary: Blocking state: org.apache.loggin.log4j.core.pattern.DatePatternConverter
Key: LOG4J2-812
URL: https://issues.apache.org/jira/browse/LOG4J2-812
Project: Log4j 2
Issue Type: Bug
Affects Versions: 2.0.2
Reporter: Mohit Anchlia
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:
-------------
Ralph Goers ***@dslextreme.com via logging.apache.org
4:28 PM (10 minutes ago)
to Log4J
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
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)