Dropwizard json layout configuration for microsecond precision

33 views Asked by At

For a dropwizard application i am using JSON layout for logging, and despite specifying 'SSSSSS' for microsecond precision in the timestampFormat, the output still defaults to '000' at the end after milliseconds. How can I configure the layout to achieve microsecond precision without the default '000' suffix

layout:
  type: json
  timestampFormat: "yyyy-MM-dd'T'HH:mm:ss.SSSSSS"
  prettyPrint: false
  appendLineSeparator: true
  includes: [timestamp, threadName, level, loggerName, message, mdc, exception]
  customFieldNames:
    timestamp: "@timestamp"
  additionalFields:
    service-name: "user-service"
  includesMdcKeys: [userId]
  flattenMdc: true

Actual. output. with above config:2023-12-12T12:28:36:972000

Expected OUTPUT: 2023-12-12T12:28:36:972123

0

There are 0 answers