You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Markus Spann (Jira)" <ji...@apache.org> on 2021/07/01 17:08:00 UTC

[jira] [Created] (LOG4J2-3115) Remember previously computed strings in NamePatternConverter

Markus Spann created LOG4J2-3115:
------------------------------------

             Summary: Remember previously computed strings in NamePatternConverter
                 Key: LOG4J2-3115
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3115
             Project: Log4j 2
          Issue Type: Improvement
          Components: Core
            Reporter: Markus Spann


Implementations of {{NamePatternConverter}} are responsible for abbreviating logger and class names according to a configured pattern.

Abbreviation can be quite complex and computationally expensive (consider abbreviating x parts of a fully qualified class name to y number of leftmost characters).

Example: The pattern {{%logger\{1.}}} abbreviates logger name {{org.apache.logging.log4j.core.pattern.NameAbbreviator}} to {{o.a.l.l.c.p.NameAbbreviator}}

The strings to abbreviate (logger and class names) are extremely likely stem from a limited set of candidates. I would like suggest that results are cached in a map to prevent computation over and over again e.g. in every log statement of a logger.

I have a small patch ready that addresses the issue.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)