quarkiverse / quarkus-logging-json

Quarkus logging extension outputting the logging in json.
Apache License 2.0
61 stars 28 forks source link

logger does not respect application object mapper #242

Open Darkvater opened 1 year ago

Darkvater commented 1 year ago

version: io.quarkiverse.loggingjson:quarkus-logging-json 1.1.1 but also 3.0.0

current behaviour: java.time.Instant is serialised as numbers, java.time.LocalDateTime is serialised as array of time components

expected behaviour: I have an ObjectMapperCustomizer setup that writes out dates and friends as strings. The json serialiser of the logger should respect it's settings (e.g. use this instance) instead of creating its own serialiser. I am aware of the existence of configuration properties that allow you to customize the json output, but apart from the fact that the date config (quarkus.log.json.fields.timestamp.date-format) is only for the timestamp fields, the application settings should be respected and not duplicated in config solely for logging purposes.

There is a similar ticket in #75, but the proposed solution of serialising the object itself is quite clunky and not usable/maintainable in a bigger project.

I think the project should hook up to be able to use CDI.

s-seidel commented 1 year ago

Also see https://github.com/quarkiverse/quarkus-logging-json/issues/169 and https://github.com/s-seidel/quarkus-logging-json-datetime