Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-262

PatternLayout does not really respect ISO8601 for date time

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 1.5.7
    • None
    • logback-core
    • None
    • irrelevant here

    Description

      Using the default "%d" "%date" or %d

      {ISO8601}

      does not output a correct ISO 8601 formatted date and time representation.
      Indeed there is a space between the date and the time, as the specification says having a space separator means there two fields : a 'date field' and a 'time field'.
      The specification consider this as acceptable for human reading though. However when processing logs it might cause some trouble to effectively parse the fields, especially when correlating logs from different applications. For now we have workarounds, but it seems reasonable to have a correct ISO8601 formatting.

      The correct ISO8601 representation for a 'date and time field' is to have the T indicator, for example '2007-03-01T13:00:00Z'.
      The workaround for now is to write ourself the correct ISO8601 pattern.

      Oh and by the way the timezone formatting options in the SimpleDateFormat are incomplete. The JodaTime format class org.joda.time.format.ISODateTimeFormat worth a look on this matter. Anyway date and time related classes in the JDK are not known for being the best at what they do.

      This problem is also found in log4j.

      An excerpt of the specification is documented on wikipedia.
      http://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            brice Brice Dutheil
            Votes:
            15 Vote for this issue
            Watchers:
            15 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: