@nilebox You’re right, that is very similar. It’s been a while since I reviewed the design. One of the design principles in the New Relic extensions was zero-injection of bytecode. Because of the way the New Relic span creation works, I think there wasn’t a zero-injection way of intercepting the message and adding context in a useful way. We ended up inheriting the MessageFactory … and at that point there was no real point in using ThreadContext when we could use our own Message class. (This is me trying to recapture the decision we made at the time; there may have been other reasons.)
https://github.com/newrelic/java-log-extensions/tree/master/log4j2
Certainly an improvement to consider in the next round!
logs
issues.