Closed vaomaohaoone closed 3 years ago
I think, that a problem with threads (main thread and AsyncLogger thread are different :) )
Yes, you're right - with AsyncLogger
log serialization is happening on Log4j2 AsyncLoggerConfig
thread, not the logging thread.
The difference in context data handling with Logger
and AsyncLogger
is that the values are not accessible via ctx
lookup.
However, context data is still copied to AsyncLogger
's RingBufferLogEvent and MutableLogEvent and resolved on the fly, so you can serialize it with your own, custom serializer for context data as described in this comment
I hope it helps.
Thanks!
Hi! I tried passing value from ThreadContext to VirtualProperty like this:
my code in Application:
ThreadContext.put("account", "elvisPresley"); Logger logger = LogManager.getLogger("elasticsearch"); logger.info("HELLO");
section with ValueProperty in log4j2.xml: `
`
And I keep getting 'undefined' in Kibana fot my field. Does anyone know how to solve this? It is my mistake or a bug?