Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.logging.log4j.core.impl.Log4jLogEvent;
import org.apache.logging.log4j.core.util.Throwables;
import org.apache.logging.log4j.message.SimpleMessage;
import org.apache.logging.log4j.util.SortedArrayStringMap;

/** Class that represents a log entry that can be written to log4j2. */
final class Log4j2SimpleLogEvent implements SimpleLogHandler {
Expand Down Expand Up @@ -84,9 +85,9 @@ LogEvent asLoggingEvent() {
// are written from the current thread.
//
// Example:
// MDC.put("user.id", userId);
// ThreadContext.put("user.id", userId);
// // do business logic that triggers logs
// MDC.clear();
// ThreadContext.clear();
//
// By using '%X{key}' in the ConversionPattern of an appender this data can be included in the
// logs.
Expand All @@ -112,7 +113,7 @@ LogEvent asLoggingEvent() {
.setThrown(thrown != null ? Throwables.getRootCause(thrown) : null)
.setIncludeLocation(true)
.setSource(getLocationInfo())
.setContextMap(mdcProperties)
.setContextData(new SortedArrayStringMap(mdcProperties))
.build();
}

Expand Down