Log4j 2
  1. Log4j 2
  2. LOG4J2-81

PatternLayout appender not respecting format modifiers

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0-alpha2
    • Fix Version/s: 2.0-beta1
    • Component/s: Layouts
    • Labels:
      None
    • Environment:

      not applicable

      Description

      Example pattern:
      [%d

      {yyyyMMdd HH:mm:ss,SSS}

      ] %-5p [%-25.25c

      {1}:%-4L] - %m%n

      Text output is:
      [20120907 14:18:36,875] INFO [XXXXXX...
      [20120907 14:18:36,875] INFO [XXXXXX...
      [20120907 14:18:36,965] ERROR [XXXXX...

      NOTE that "INFO" and "ERROR" are not left justified for 5 spaces (%-5p)


      The logger name ([%-25.25c{1}

      ) is not left justified or padded when there are less then 25 characters

      The line number is not left justified or padded either (%-4L)

        Activity

        Hide
        Ralph Goers added a comment -

        When I incorporated the EnhancedPatternLayout from LOG4J1 I missed taking into account the FormattingInfo objects and their format method was not being called. I've fixed that in revision 1382402. Please test and close after verifying the fix.

        Show
        Ralph Goers added a comment - When I incorporated the EnhancedPatternLayout from LOG4J1 I missed taking into account the FormattingInfo objects and their format method was not being called. I've fixed that in revision 1382402. Please test and close after verifying the fix.

          People

          • Assignee:
            Ralph Goers
            Reporter:
            Bob G
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development