You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We currently use a JSON logger. If I add this config: kamon.instrumentation.logback.mdc.copy.entries = [ foo ], then foo would be logged as an empty value even though foo is not in the current context:
{
"foo" : ""
}
So the workaround is adding the following code to logback.xml and remove kamon.instrumentation.logback.mdc.copy.entries = [ foo ]:
We currently use a JSON logger. If I add this config:
kamon.instrumentation.logback.mdc.copy.entries = [ foo ]
, thenfoo
would be logged as an empty value even thoughfoo
is not in the current context:So the workaround is adding the following code to
logback.xml
and removekamon.instrumentation.logback.mdc.copy.entries = [ foo ]
:Temporary fix
In https://github.com/kamon-io/Kamon/blob/master/instrumentation/kamon-logback/src/main/scala/kamon/instrumentation/logback/LogbackInstrumentation.scala, it seems only context tags that are in the current context are reported.
We have a very simple use case that all K-V pairs have the string type. So we use context tags instead of context entries.
Expected behavior
If a context entry is not in the current context, then it should not be logged.
Proposed fix
In https://github.com/kamon-io/Kamon/blob/master/instrumentation/kamon-logback/src/main/scala/kamon/instrumentation/logback/LogbackInstrumentation.scala, because of
Context.key[Any](key, "")
, which means""
is returned by default ifkey
is not in the current context. Hence, we can add extra if-check like this to eliminate the issue:The text was updated successfully, but these errors were encountered: