Return-Path: X-Original-To: apmail-logging-log4j-dev-archive@www.apache.org Delivered-To: apmail-logging-log4j-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BBAFE17949 for ; Sat, 11 Jul 2015 20:27:04 +0000 (UTC) Received: (qmail 93438 invoked by uid 500); 11 Jul 2015 20:27:04 -0000 Delivered-To: apmail-logging-log4j-dev-archive@logging.apache.org Received: (qmail 93370 invoked by uid 500); 11 Jul 2015 20:27:04 -0000 Mailing-List: contact log4j-dev-help@logging.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@logging.apache.org Received: (qmail 93360 invoked by uid 99); 11 Jul 2015 20:27:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 11 Jul 2015 20:27:04 +0000 Date: Sat, 11 Jul 2015 20:27:04 +0000 (UTC) From: "Gary Gregory (JIRA)" To: log4j-dev@logging.apache.org Message-ID: In-Reply-To: References: Subject: =?utf-8?Q?[jira]_[Comment_Edited]_(LOG4J2-8?= =?utf-8?Q?12)_Performance_optimization:_avo?= =?utf-8?Q?id_use_of_synchronized_SimpleDate?= =?utf-8?Q?Format_in_Dat=E2=80=8BePatternCo=E2=80=8Bnverter_?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LOG4J2-812?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1462= 0032#comment-14620032 ]=20 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 me= ntion 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 exampl= e: "Copied from Commons Lang 3.4 tag http://..." or "Copied from Commons La= ng 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 source= s in the package, in a package comment, this would let the only change be i= n 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 me= ntion 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 exampl= e: "Copied from Commons Lang 3.4 tag http://..." or "Copied from Commons La= ng 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 D= at=E2=80=8BePatternCo=E2=80=8Bnverter=20 > -------------------------------------------------------------------------= ---------------------- > > 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=E2=80=8B.loggin.lo=E2=80= =8Bg4j.core.p=E2=80=8Battern.Dat=E2=80=8BePatternCo=E2=80=8Bnverter. It's s= hort 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 =20 > 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 do= ne to this > What I would do is modify DatePatternConverter to > a) use Java 8=E2=80=99s java.time.format.DateTimeFormatter if running on= Java 8 > b) use Joda Time=E2=80=99s 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