[ 
https://issues.apache.org/jira/browse/LOG4J2-2365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16531683#comment-16531683
 ] 

ASF GitHub Bot commented on LOG4J2-2365:
----------------------------------------

GitHub user undefz opened a pull request:

    https://github.com/apache/logging-log4j2/pull/188

    LOG4J2-2365 Make NameAbbreviator correctly abbreviate first fragments

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/undefz/logging-log4j2 master

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/logging-log4j2/pull/188.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #188
    
----
commit 29578d19ae0e8ab7940e86d92d4244a5f73cd781
Author: Eugene Zimichev <undefz@...>
Date:   2018-07-03T16:56:54Z

    LOG4J2-2365 Make NameAbbreviator correctly abbreviate first fragments

----


> NameAbbreviator skips first fragments
> -------------------------------------
>
>                 Key: LOG4J2-2365
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2365
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Pattern Converters
>    Affects Versions: 2.11.0
>            Reporter: Eugene Zimichev
>            Priority: Major
>
> When I use LoggernPatternConverter in beginning of my layout it outputs as 
> expected
> {code:java}
> <PatternLayout pattern="%c{1.1.*} %date{HH:mm:ss.SSS} %-5level %-25thread| 
> %msg%n%xThrowable"/>{code}
> {code:java}
> c.k.zoo.CuratorEnsembleProvider 16:48:13.175 INFO main | Connecting to 
> ensemble on [localhost]:8080{code}
>  However when I move converter to the end of the layout it stops abbreviating 
> logger name parts.
> {code:java}
> <PatternLayout pattern="%date{HH:mm:ss.SSS} %-5level %-25thread| %c{1.1.*} 
> %msg%n%xThrowable"/>{code}
> {code:java}
> 16:47:38.687 INFO main | com.kamagames.zoo.CuratorEnsembleProvider Connecting 
> to ensemble on [localhost]:8080{code}
>  
> I believe it's caused by code in NameAbbreviator which stops processing first 
> pattern fragments when abbreviated string length is larger than current 
> position in StringBuilder
>  
> {code:java}
> for (int i = 0; i < fragments.length - 1 && pos < original.length(); i++) {
>  pos = fragments[i].abbreviate(sb, pos);
> } {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to