Is there a way to pass additional information that applies only to the current log event with slf4j? Requesting information, such as user, IP address or application name, can be saved and obtained through the MDC. Later I can access this information in a breadboard or converter and should not parse the log message. If I use a JSON based format, I have another field with "appName":myApp, and if I register log4j in the plaint text, I can access it through a note%{appName}. Is there a way to achieve this with information that applies to only one log event? For example, I want to pass an exception identifier (even for exceptions that I do not own). The best, but still ugly solution is to pass the identifier to the MDC, register an exception, and then delete it. Does anyone know a better solution?
source
share