Skip to content

Augment log messages via LOG4J's `ThreadContext`

Peter Fischer requested to merge structured-logging-fix into main

Using ObjectMessage failed when run inside a task manager, probably due to class loading issues. EcsLayout tries to detect if a JSON serializer is available at runtime (see ObjectMessageJacksonSerializer.Resolver). If that cannot be found or the performed instance-of-ObjectMessage returns false, EcsLayout calls ObjectMessage.getFormattedMessage() which ends up calling Map.toString(). Hence, we end up with a single message property that holds a string like {message=…, wiki=…}, instead of message and wiki. Going with ThreadContext instead is what LOG4J2's implementation of SLF4J2 does, too.

Change-Id: I9e66fb8c0fe13dd09e61fc01a044cb9a2aa57d7f

Merge request reports