kamon-io / kamon-logback

12 stars 17 forks source link

ContextEntryConverter always uses default value if provided #30

Closed amelnikov-mylivn closed 5 years ago

amelnikov-mylivn commented 5 years ago

If the default value is provided - ContextEntryConverter uses the wrong entry name.

Let's say this is my logback pattern %contextEntry{MyValue:MyDefault}

If we follow the code at https://github.com/kamon-io/kamon-logback/blob/78a1ec1ff64128443b5c20afcda72a69a5d2d093/src/main/scala/kamon/instrumentation/logback/tools/ContextEntryConverter.scala#L35

we will see that getFirstOption will have value MyValue:MyDefault where it should be MyValue. Therefore if the default is specified - the original value will be always ignored.