[ 
https://issues.apache.org/jira/browse/LOG4J2-3115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Markus Spann updated LOG4J2-3115:
---------------------------------
    Description: 
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) extremely likely stem from a 
limited set of candidates. I would like to suggest that results are cached 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.

  was:
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.


> 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
>            Priority: Minor
>
> 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) extremely likely stem from 
> a limited set of candidates. I would like to suggest that results are cached 
> 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)

Reply via email to