Class JsonLayout

  • All Implemented Interfaces:
    ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.LifeCycle

    public class JsonLayout
    extends ch.qos.logback.core.spi.ContextAwareBase
    implements ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
    A layout that converts a logback event to a string in JSON format. This layout can be used as an alternative to the default PatternLayout
    • Constructor Detail

      • JsonLayout

        public JsonLayout()
    • Method Detail

      • doLayout

        public java.lang.String doLayout​(ch.qos.logback.classic.spi.ILoggingEvent event)
        Specified by:
        doLayout in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      • start

        public void start()
        Specified by:
        start in interface ch.qos.logback.core.spi.LifeCycle
      • stop

        public void stop()
        Specified by:
        stop in interface ch.qos.logback.core.spi.LifeCycle
      • addCustomProvider

        public void addCustomProvider​(JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> provider)
      • isStarted

        public boolean isStarted()
        Specified by:
        isStarted in interface ch.qos.logback.core.spi.LifeCycle
      • getFileHeader

        public java.lang.String getFileHeader()
        Specified by:
        getFileHeader in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      • getPresentationHeader

        public java.lang.String getPresentationHeader()
        Specified by:
        getPresentationHeader in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      • getPresentationFooter

        public java.lang.String getPresentationFooter()
        Specified by:
        getPresentationFooter in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      • getFileFooter

        public java.lang.String getFileFooter()
        Specified by:
        getFileFooter in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      • getContentType

        public java.lang.String getContentType()
        Specified by:
        getContentType in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>