To fully align with ISO-8601, use yyyy-MM-dd'T'HH:mm:ss.SSSXXX as the default logging date format
See original GitHub issueAt present the default logging pattern does not append any timezone / offset information to the time of the event. This makes it impossible to parse back into an instant reliably (e.g. when using a log exporter to push a docker container’s stdout to elasticsearch or similar), because the timezone will be system / system property dependent.
Should just be a matter of adding XXX to the end of the default for LOG_DATEFORMAT_PATTERN in org/springframework/boot/logging/logback/defaults.xml & org.springframework.boot.logging.logback.DefaultLogbackConfiguration.
A good test is that the result is parseable by ZonedDateTime.parse. See DateConverterSpec which shows only XXX reliably produces a parseable ISO 8601 string.
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Converting ISO 8601-compliant String to java.util.Date
I found the pattern yyyy-MM-dd'T'HH:mm:ssZ to be ISO8601-compliant if used with a Locale (compare sample). However, using the java.text.SimpleDateFormat , I ...
Read more >PatternLayout does not really respect ISO8601 for date time
Using the default "%d" "%date" or %d. {ISO8601}. does not output a correct ISO 8601 formatted date and time representation.
Read more >DateTimeFormat.ISO (Spring Framework 6.0.2 API)
The most common ISO Date Time Format yyyy-MM-dd'T'HH:mm:ss.SSSXXX — for example, "2000-10-31T01:30:00.000-05:00". NONE. Indicates that no ISO-based format ...
Read more >FixedDateFormat.FixedFormat (Apache Log4j Core 2.19.0 API)
Returns the FastDateFormat object for formatting the date part of the pattern or null if the pattern does not have a date part....
Read more >SimpleDateFormat (Java Platform SE 8 ) - Oracle Help Center
Each of these class methods can return a date/time formatter initialized with a default format pattern. You may modify the format pattern using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We’ve discussed this today and we’re going to add the
T. We’ll make the changes for both Logback and Log4j2.@wilkinsona Yes, please do so. ISO 8601 clearly says (if you have access to the document): the ‘T’ can be replaced with a space only if a mutual agreement has been done between parties.
Same mistake was done in Git and they have ‘corrected’ with
iso-strict.