I am trying to set up logging to JSON file and I need nanoseconds to be logged. However when I try the next structure
<JsonLayout compact="true" properties="true" eventEol="true" >
<KeyValuePair key="timestamp" value="$${date:HH:mm:ss.nnnnnnnnn}" />
</JsonLayout>
I get the error:
ERROR Invalid date format: [HH:mm:ss.nnnnnnnnn], using default java.lang.IllegalArgumentException: Illegal pattern character 'n'
I tried different patterns with nanoseconds with no success.
For .log file the next pattern works, however, it doesn't work for .json (or I apply it incorrectly).
<PatternLayout pattern="%d{DEFAULT_NANOS} />
Any ideas?
P.S. Log4j 2.11.0