Package com.github.loki4j.logback
Class JsonLayout
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- com.github.loki4j.logback.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 defaultPatternLayout
-
-
Constructor Summary
Constructors Constructor Description JsonLayout()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCustomProvider(JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> provider)java.lang.StringdoLayout(ch.qos.logback.classic.spi.ILoggingEvent event)java.lang.StringgetContentType()java.lang.StringgetFileFooter()java.lang.StringgetFileHeader()java.lang.StringgetPresentationFooter()java.lang.StringgetPresentationHeader()booleanisStarted()voidsetLoggerName(LoggerNameJsonProvider loggerName)voidsetLogLevel(LogLevelJsonProvider logLevel)voidsetMdc(MdcJsonProvider mdc)voidsetMessage(MessageJsonProvider message)voidsetStackTrace(StackTraceJsonProvider stackTrace)voidsetThreadName(ThreadNameJsonProvider threadName)voidsetTimestamp(TimestampJsonProvider timestamp)voidstart()voidstop()-
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
-
-
-
Method Detail
-
doLayout
public java.lang.String doLayout(ch.qos.logback.classic.spi.ILoggingEvent event)
- Specified by:
doLayoutin interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
start
public void start()
- Specified by:
startin interfacech.qos.logback.core.spi.LifeCycle
-
stop
public void stop()
- Specified by:
stopin interfacech.qos.logback.core.spi.LifeCycle
-
addCustomProvider
public void addCustomProvider(JsonProvider<ch.qos.logback.classic.spi.ILoggingEvent> provider)
-
setTimestamp
public void setTimestamp(TimestampJsonProvider timestamp)
-
setLoggerName
public void setLoggerName(LoggerNameJsonProvider loggerName)
-
setLogLevel
public void setLogLevel(LogLevelJsonProvider logLevel)
-
setThreadName
public void setThreadName(ThreadNameJsonProvider threadName)
-
setMessage
public void setMessage(MessageJsonProvider message)
-
setStackTrace
public void setStackTrace(StackTraceJsonProvider stackTrace)
-
setMdc
public void setMdc(MdcJsonProvider mdc)
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfacech.qos.logback.core.spi.LifeCycle
-
getFileHeader
public java.lang.String getFileHeader()
- Specified by:
getFileHeaderin interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
getPresentationHeader
public java.lang.String getPresentationHeader()
- Specified by:
getPresentationHeaderin interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
getPresentationFooter
public java.lang.String getPresentationFooter()
- Specified by:
getPresentationFooterin interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
getFileFooter
public java.lang.String getFileFooter()
- Specified by:
getFileFooterin interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
getContentType
public java.lang.String getContentType()
- Specified by:
getContentTypein interfacech.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
-
-