Skip to content

Conversation

ecerulm
Copy link

@ecerulm ecerulm commented Sep 29, 2025

By default this will encode messages as

{"sequenceNumber":0,"timestamp":{"seconds":1759181937,"nanos":602356000},"threadName":"main","loggerName":"ch.qos.logback.classic.encoder.StructuredLoggingJsonEncoderTest","context":{"name":"test_180988152","birthdate":1759181937520,"properties":{}},"mdc": {},"message":"hello logback","throwable":null,"severity":"WARN"}

The difference with JsonEncoder is

  • timestamp becomes timestamp.seconds and timestamp.nanos
  • level becomes severity
  • message now contains the formatter message
  • arguments is suppressed

The idea is that this encoder produces output that is more compatible with Google logging agent expected format in particular the GKE logging agent.

Signed-off-by: Rubén Laguna <[email protected]>
@ecerulm
Copy link
Author

ecerulm commented Sep 29, 2025

This contains no changes to docs, I'll add that later depending on the comments / changes requested.

@ecerulm ecerulm marked this pull request as ready for review September 29, 2025 21:42
@ecerulm ecerulm changed the title Add StructuredLogginJsonEncoder Add StructuredLoggingJsonEncoder Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant