Skip to content
Merged
Show file tree
Hide file tree
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 @@ -71,6 +71,7 @@ public class LoggingAppender extends UnsynchronizedAppenderBase<ILoggingEvent> {

private static final String LEVEL_NAME_KEY = "levelName";
private static final String LEVEL_VALUE_KEY = "levelValue";
private static final String LOGGER_NAME_KEY = "loggerName";

private volatile Logging logging;
private LoggingOptions loggingOptions;
Expand Down Expand Up @@ -274,7 +275,8 @@ private LogEntry logEntryFor(ILoggingEvent e) {

builder
.addLabel(LEVEL_NAME_KEY, level.toString())
.addLabel(LEVEL_VALUE_KEY, String.valueOf(level.toInt()));
.addLabel(LEVEL_VALUE_KEY, String.valueOf(level.toInt()))
.addLabel(LOGGER_NAME_KEY, e.getLoggerName());

for (Map.Entry<String, String> entry : e.getMDCPropertyMap().entrySet()) {
if (null != entry.getKey() && null != entry.getValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public void testFlushLevelConfigUpdatesLoggingFlushSeverity() {
new ImmutableMap.Builder<String, String>()
.put("levelName", "WARN")
.put("levelValue", String.valueOf(30000L))
.put("loggerName", this.getClass().getName())
.build())
.build();
logging.setFlushSeverity(Severity.WARNING);
Expand Down Expand Up @@ -113,6 +114,7 @@ public void testFilterLogsOnlyLogsAtOrAboveLogLevel() {
new ImmutableMap.Builder<String, String>()
.put("levelName", "ERROR")
.put("levelValue", String.valueOf(40000L))
.put("loggerName", this.getClass().getName())
.build())
.build();
logging.setFlushSeverity(Severity.ERROR);
Expand Down Expand Up @@ -147,6 +149,7 @@ public void testEnhancersAddCorrectLabelsToLogEntries() {
new ImmutableMap.Builder<String, String>()
.put("levelName", "WARN")
.put("levelValue", String.valueOf(30000L))
.put("loggerName", this.getClass().getName())
.put("test-label-1", "test-value-1")
.put("test-label-2", "test-value-2")
.build())
Expand Down Expand Up @@ -195,6 +198,7 @@ public void testMdcValuesAreConvertedToLabels() {
new ImmutableMap.Builder<String, String>()
.put("levelName", "INFO")
.put("levelValue", String.valueOf(20000L))
.put("loggerName", this.getClass().getName())
.put("mdc1", "value1")
.put("mdc2", "value2")
.build())
Expand Down Expand Up @@ -246,6 +250,7 @@ private LoggingEvent createLoggingEvent(Level level, long timestamp) {
loggingEvent.setMessage("this is a test");
loggingEvent.setLevel(level);
loggingEvent.setTimeStamp(timestamp);
loggingEvent.setLoggerName(this.getClass().getName());
return loggingEvent;
}

Expand Down