zio-logging icon indicating copy to clipboard operation
zio-logging copied to clipboard

Spans are not propagated to the log4j backend

Open lukasz-golebiewski opened this issue 1 year ago • 3 comments

A reproducer is available here: https://github.com/lukasz-golebiewski/zio-logging-example

lukasz-golebiewski avatar Jun 15 '24 12:06 lukasz-golebiewski

Looks like the solution was to concat LogFormat.spans with the default SLF4J log format.

SLF4J.slf4j(LogFormat.spans + SLF4J.logFormatDefault)

Is there a reason why spans are not being logged in the default format?

lukasz-golebiewski avatar Jun 17 '24 09:06 lukasz-golebiewski

Hi @lukasz-golebiewski I think reason for that is that LogFormat of core zio loggers https://github.com/zio/zio-logging/blob/master/core/shared/src/main/scala/zio/logging/LogFormat.scala#L917-L922 also do not contains spans, so they were not added also to slf4j default format

justcoon avatar Jun 18 '24 07:06 justcoon

This is interesting, because an app extending ZIOAppDefault without overridden bootstrap, so using the default zio logger, does log spans out of the box

lukasz-golebiewski avatar Jun 18 '24 07:06 lukasz-golebiewski