GitHub user ppkarwasz added a comment to the discussion: Getting current 
date-time format (or default format)

Thanks for the question!

Could you tell us more about your use case? For example, are you trying to 
introspect the effective Log4j Core configuration at runtime, or are you 
attempting to parse the output of a `PatternLayout`?

If you're aiming to parse logs, keep in mind that most formats produced by 
`PatternLayout` aren't designed to be reliably machine-parsed. In such cases, 
we strongly recommend using a structured logging format (like 
`JsonTemplateLayout`) instead.

As for the default datetime pattern, it's currently `yyyy-MM-dd HH:mm:ss,SSS`. 
This pattern has been stable for a long time and is unlikely to change anytime 
soon due to backward compatibility. We could make the 
`DatePatternConverter#DEFAULT_PATTERN` public, but referencing it in your own 
code may not be ideal, though—it’s a compile-time constant. If Log4j Core 
changes that value in a future version, your compiled code will retain the old 
value unless you recompile against the updated library.

Let us know more about what you're trying to achieve—we're happy to offer more 
specific guidance!



GitHub link: 
https://github.com/apache/logging-log4j2/discussions/3788#discussioncomment-13600712

----
This is an automatically sent email for dev@logging.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@logging.apache.org

Reply via email to