Skip to content

Commit

Permalink
Add MDC support in Logback appender
Browse files Browse the repository at this point in the history
  • Loading branch information
dietervdw-spotify committed Feb 11, 2019
1 parent 44db769 commit 5b48648
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
Expand Down Expand Up @@ -232,6 +233,11 @@ private LogEntry logEntryFor(ILoggingEvent e) {
.addLabel(LEVEL_NAME_KEY, level.toString())
.addLabel(LEVEL_VALUE_KEY, String.valueOf(level.toInt()));


for (Map.Entry<String, String> entry : e.getMDCPropertyMap().entrySet()) {
builder.addLabel(entry.getKey(), entry.getValue());
}

if (loggingEnhancers != null) {
for (LoggingEnhancer enhancer : loggingEnhancers) {
enhancer.enhanceLogEntry(builder);
Expand Down

0 comments on commit 5b48648

Please sign in to comment.