Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

[logback-mongodb-classic] Added marker storage #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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 @@ -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
Expand All @@ -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());
}
Expand Down