All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sumologic.logback.json.CustomJsonLayout Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy