[logback-dev] ISO8601 format

Ceki Gülcü ceki at qos.ch
Tue Jun 17 23:38:32 CEST 2014


Hello everyone,

At present time, %d{ISO8601} is equivalent to writing
%d{"yyyy-MM-dd HH:mm:ss,SSS"}. However, to match the ISO8601
standard the output should be that of %d{"yyyy-MM-dd'T'HH:mm:ss,SSS"}. 
Note the 'T' in the middle.

On the other hand, there is also a necessity to maintain backward 
compatibility for log parsers that rely on the current albeit incorrect 
format.

Thus, we are hesitating between two options

Option 1)

Introduce the constant ISO8601_OLD so that %d{ISO8601_OLD} is 
interpreted as equivalent to %d{"yyyy-MM-dd HH:mm:ss,SSS"}
and *change* %d{ISO8601} so it is now equivalent to
%d{"yyyy-MM-dd HH:mm:ss,SSS"}.


Option 2)

Keep %d{ISO8601} as equivalent to %d{"yyyy-MM-dd HH:mm:ss,SSS"}
and *introduce* new constant ISO8601_STRICT so that %d{ISO8601_STRICT} 
is interpreted as equivalent to %d{"yyyy-MM-dd'T'HH:mm:ss,SSS"}.


Personally, I favor the latter (option 2) as it preserves backward 
compatibility and allows users to easily refer to the correct ISO8601 
format if they wish to do so. Indeed, writing  %d{ISO8601_STRICT}  is 
easier than %d{"yyyy-MM-dd'T'HH:mm:ss,SSS"}. Moreover, we can encourage 
the use of %d{ISO8601_STRICT} by favoring it in the documentation, e.g. 
by mentioning it more often.

Note that writing just %d is equivalent to writing  %d{ISO8601}. Thus, 
we can assume that for most user the output generated by %d is done 
using the default, i.e. the incorrect format, making the backward 
compatibility argument more potent.

Cheers,
--
Ceki

On 6/17/2014 4:22, Tony Trinh wrote:
> Per LOGBACK-262 [1], logback does not conform to ISO8601 when printing
> %d{ISO8601}. We're in the process of fixing this [2], but we'd like to
> maintain backward compatibility for log parsers that might rely on the
> incorrect format. We have a couple options.
>
> OPTION 1. Add a new option for %d that enables the legacy incorrect
> format. Deprecate it, and remove it after several releases. Examples:
>
>    %d{ISO8601_OLD}
>    %d{NOT8601}
>    %d{OLD8601}
>    %d{ISO8601,,old}
>    other?
>
> OPTION 2. Force users to specify a custom date format that matches the
> legacy incorrect format:
>
>    %d{"yyyy-MM-dd HH:mm:ss,SSS"}
>
> Please provide feedback on these options (or a new one) by June 23.
>
> Thanks,
> Tony
>
> [1] http://jira.qos.ch/browse/LOGBACK-262
> [2] https://github.com/qos-ch/logback/pull/207
>


More information about the logback-dev mailing list