Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2785

Pattern Layout to abbreviate the name of all logger components except the 2 rightmost

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 2.19.1
    • Layouts
    • None

    Description

      The following are my favorite patterns

      %c{2} - which displays the corresponding number of rightmost logger name components. So a logger with a name like "org.apache.commons.Foo" is displayed as "commons.Foo".

      and

      %c{1.} - which abbreviates the name based on the pattern. So a logger with a name like "org.apache.commons.Foo" is displayed as "o.a.c.Foo".

      Is there a way to combine the two. I want to abbreviate the name of all logger components except the 2 rightmost. Such that "org.apache.commons.Foo" is displayed as "o.a.commons.Foo".

      Attachments

        Issue Links

          Activity

            People

              rgoers Ralph Goers
              khimasia Rahul Khimasia
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: