com.sumologic.logback.json.CustomJsonLayout Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sumo-logback-appender Show documentation
Show all versions of sumo-logback-appender Show documentation
Forked project which pushes logs to sumo-logic in json format
The newest version!
package com.sumologic.logback.json;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.contrib.json.classic.JsonLayout;
import java.util.Map;
public class CustomJsonLayout extends JsonLayout {
@Override
protected Map toJsonMap(ILoggingEvent event) {
// Add default params to log.
Map map = super.toJsonMap(event);
// Add context params to log.
map.putAll(event.getLoggerContextVO().getPropertyMap());
// Add MDC parameters holding our header parameters.
map.putAll(event.getMDCPropertyMap());
return map;
}
}