Log4j 2
  1. Log4j 2
  2. LOG4J2-749

Retain the default date pattern after fixing ISO8601_PATTERN

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.0.1
    • Component/s: Layouts, Pattern Converters
    • Labels:
      None

      Description

      Scott Harrington correctly pointed out the following (from comments on LOG4J2-670):

      You're going to get complaints from more folks about changing this long-standing format, which happens to be the default if nothing is specified after the '%d'.
      What I mean is, a lot of people have been getting the space separator, and they are not explicitly asking for ISO8601, and now they're going to start getting a 'T' separator.
      Presence/absence of a space will affect anyone who slices up their log files using awk or cut with whitespace delimiters.

      I suggest you introduce a new pattern named 'DEFAULT' (and which gets used by default):

      %d{ISO8601} = yyyy-MM-dd'T'HH:mm:ss,SSS
      %d{ISO8601_BASIC} = yyyyMMdd'T'HHmmss,SSS
      %d = %d{DEFAULT} = yyyy-MM-dd HH:mm:ss,SSS
      

        Issue Links

          Activity

          Remko Popma created issue -
          Remko Popma made changes -
          Field Original Value New Value
          Link This issue supercedes LOG4J2-670 [ LOG4J2-670 ]
          Remko Popma made changes -
          Description Scott Harrington correctly pointed out the following (from comments on LOG4J2-670):

          You're going to get complaints from more folks about changing this long-standing format, which happens to be the default if nothing is specified after the '%d'.
          What I mean is, a lot of people have been getting the space separator, and they are not explicitly asking for ISO8601, and now they're going to start getting a 'T' separator.
          Presence/absence of a space will affect anyone who slices up their log files using awk or cut with whitespace delimiters.

          I suggest you introduce a new pattern named 'DEFAULT' (and which gets used by default):
          {code}
          %d{ISO8601} = yyyy-MM-dd'T'HH:mm:ss,SSS
          %d{ISO8601_BASIC} = yyyyMMdd'T'HHmmss,SSS
          %d = %d{DEFAULT} = yyyy-MM-dd HH:mm:ss,SSS
          {code}
          Remko Popma made changes -
          Assignee Remko Popma [ remkop@yahoo.com ]
          Hide
          Remko Popma added a comment -

          Applied Scott's patch (attached to LOG4J2-670) with some additional test cases in revision 1613750.
          Please verify and close.

          Show
          Remko Popma added a comment - Applied Scott's patch (attached to LOG4J2-670 ) with some additional test cases in revision 1613750. Please verify and close.
          Remko Popma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Matt Sicker added a comment -

          Remko, you're the reporter! I think this is closeable.

          Show
          Matt Sicker added a comment - Remko, you're the reporter! I think this is closeable.
          Matt Sicker made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Remko Popma added a comment -

          Thanks!

          Show
          Remko Popma added a comment - Thanks!

            People

            • Assignee:
              Remko Popma
              Reporter:
              Remko Popma
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development