Log4j 2
  1. Log4j 2
  2. LOG4J2-383

[Pattern Layout] Customize level names by length

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-beta9
    • Component/s: Layouts
    • Labels:
      None
    • Environment:

      Description

      The level in a pattern layout can be defined as:

      %level{length=n}
      

      For example:

      %level{length=1}
      

      Which will give you log level names:

      • I for Info
      • W for Warning
      • D for Debug
      • and so on.

      If n is greater than a level name length, the length of the level name is used.

      Note that the level name computation is done when the pattern is created, thus having no impact on logging performance.

        Activity

        Gary Gregory created issue -
        Hide
        Gary Gregory added a comment -
        commit -m "[LOG4J2-383][Pattern Layout] Customize level name by length." C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml C:/vcs/svn/apache/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/LevelPatternConverter.java C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/LevelPatternConverterTest.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/LevelPatternConverter.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/LevelPatternConverterTest.java
            Sending        C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml
            Sending        C:/vcs/svn/apache/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm
            Transmitting file data ...
            Committed revision 1519760.
        
        Show
        Gary Gregory added a comment - commit -m "[LOG4J2-383][Pattern Layout] Customize level name by length." C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml C:/vcs/svn/apache/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/LevelPatternConverter.java C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/LevelPatternConverterTest.java Sending C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/pattern/LevelPatternConverter.java Sending C:/vcs/svn/apache/log4j2/trunk/log4j-core/src/test/java/org/apache/logging/log4j/core/pattern/LevelPatternConverterTest.java Sending C:/vcs/svn/apache/log4j2/trunk/src/changes/changes.xml Sending C:/vcs/svn/apache/log4j2/trunk/src/site/xdoc/manual/layouts.xml.vm Transmitting file data ... Committed revision 1519760.
        Gary Gregory made changes -
        Field Original Value New Value
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Gary Gregory made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Gary Gregory made changes -
        Summary [Pattern Layout] Customize level name by length [Pattern Layout] Customize level names by length
        Matt Sicker made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Gary Gregory
            Reporter:
            Gary Gregory
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development