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

org.entur.logger.logstash.LogstashEncoder Maven / Gradle / Ivy

There is a newer version: 1.101
Show newest version
package org.entur.logger.logstash;

import ch.qos.logback.classic.spi.ILoggingEvent;
import net.logstash.logback.composite.JsonProviders;
import net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder;

/**
 * Custom Logstash encoder that encodes properly message severity for the level "WARNING".
 * The default implementation maps WARNING-messages to the severity "WARN", while StackDriver
 * expects the severity to be "WARNING".
 */
public class LogstashEncoder extends LoggingEventCompositeJsonEncoder {

    @Override
    public void start() {
        JsonProviders providers = getProviders();
        providers.addProvider(new LogstashLogLevelJsonProvider());
        super.start();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy