[logback-dev] [JIRA] Created: (LBCORE-137) PatternLayout does not really respect ISO8601 for date time

Brice Dutheil (JIRA) noreply-jira at qos.ch
Wed Feb 24 15:58:16 CET 2010


PatternLayout does not really respect ISO8601 for date time
-----------------------------------------------------------

                 Key: LBCORE-137
                 URL: http://jira.qos.ch/browse/LBCORE-137
             Project: logback-core
          Issue Type: Improvement
          Components: Layout
    Affects Versions: 0.9.19
         Environment: irrelevant here
            Reporter: Brice Dutheil
            Assignee: Logback dev list


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

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list