From 4df06c20345132d61252278298a4b022a1131329 Mon Sep 17 00:00:00 2001 From: Stanislav Neuberger Date: Mon, 12 Feb 2018 10:22:12 +0100 Subject: [PATCH] [logback-mongodb-classic] Added marker storage --- .../contrib/mongodb/MongoDBLoggingEventAppender.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mongodb/classic/src/main/java/ch/qos/logback/contrib/mongodb/MongoDBLoggingEventAppender.java b/mongodb/classic/src/main/java/ch/qos/logback/contrib/mongodb/MongoDBLoggingEventAppender.java index 6747bcd..1cdc774 100644 --- a/mongodb/classic/src/main/java/ch/qos/logback/contrib/mongodb/MongoDBLoggingEventAppender.java +++ b/mongodb/classic/src/main/java/ch/qos/logback/contrib/mongodb/MongoDBLoggingEventAppender.java @@ -12,14 +12,14 @@ */ package ch.qos.logback.contrib.mongodb; -import java.util.Date; - import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy; import com.mongodb.BasicDBList; import com.mongodb.BasicDBObject; +import java.util.Date; + /** * @author Christian Trutz * @author Tomasz Nurkiewicz @@ -37,6 +37,9 @@ protected BasicDBObject toMongoDocument(ILoggingEvent event) { logEntry.append("thread", event.getThreadName()); logEntry.append("timestamp", new Date(event.getTimeStamp())); logEntry.append("level", event.getLevel().toString()); + if (event.getMarker() != null) { + logEntry.append("marker", event.getMarker().getName()); + } if (event.getMDCPropertyMap() != null && !event.getMDCPropertyMap().isEmpty()) { logEntry.append("mdc", event.getMDCPropertyMap()); }