Class JsonLayout

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.LayoutBase<ch.qos.logback.classic.spi.ILoggingEvent>
io.kokuwa.micronaut.logging.layout.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
Direct Known Subclasses:
GcpJsonLayout

public class JsonLayout extends ch.qos.logback.core.LayoutBase<ch.qos.logback.classic.spi.ILoggingEvent>
  • Field Details

    • TIMESTAMP_ATTR_NAME

      public static final String TIMESTAMP_ATTR_NAME
      See Also:
    • LEVEL_ATTR_NAME

      public static final String LEVEL_ATTR_NAME
      See Also:
    • THREAD_ATTR_NAME

      public static final String THREAD_ATTR_NAME
      See Also:
    • MDC_ATTR_NAME

      public static final String MDC_ATTR_NAME
      See Also:
    • LOGGER_ATTR_NAME

      public static final String LOGGER_ATTR_NAME
      See Also:
    • FORMATTED_MESSAGE_ATTR_NAME

      public static final String FORMATTED_MESSAGE_ATTR_NAME
      See Also:
    • MESSAGE_ATTR_NAME

      public static final String MESSAGE_ATTR_NAME
      See Also:
    • EXCEPTION_ATTR_NAME

      public static final String EXCEPTION_ATTR_NAME
      See Also:
    • CONTEXT_ATTR_NAME

      public static final String CONTEXT_ATTR_NAME
      See Also:
    • includeLevel

      protected boolean includeLevel
    • includeThreadName

      protected boolean includeThreadName
    • includeMDC

      protected boolean includeMDC
    • includeLoggerName

      protected boolean includeLoggerName
    • includeFormattedMessage

      protected boolean includeFormattedMessage
    • includeMessage

      protected boolean includeMessage
    • includeException

      protected boolean includeException
    • includeContextName

      protected boolean includeContextName
    • includeTimestamp

      protected boolean includeTimestamp
  • Constructor Details

    • JsonLayout

      public JsonLayout()
  • Method Details

    • getContentType

      public String getContentType()
      Specified by:
      getContentType in interface ch.qos.logback.core.Layout<ch.qos.logback.classic.spi.ILoggingEvent>
      Overrides:
      getContentType in class ch.qos.logback.core.LayoutBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • start

      public void start()
      Specified by:
      start in interface ch.qos.logback.core.spi.LifeCycle
      Overrides:
      start in class ch.qos.logback.core.LayoutBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • stop

      public void stop()
      Specified by:
      stop in interface ch.qos.logback.core.spi.LifeCycle
      Overrides:
      stop in class ch.qos.logback.core.LayoutBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • doLayout

      public String doLayout(ch.qos.logback.classic.spi.ILoggingEvent event)
    • toJsonMap

      protected Map<String,Object> toJsonMap(ch.qos.logback.classic.spi.ILoggingEvent event)
    • addThrowableInfo

      protected void addThrowableInfo(String fieldName, boolean field, ch.qos.logback.classic.spi.ILoggingEvent value, Map<String,Object> map)
    • addMap

      protected void addMap(String key, boolean field, Map<String,?> mapValue, Map<String,Object> map)
    • addTimestamp

      protected void addTimestamp(String key, boolean field, long timeStamp, Map<String,Object> map)
    • add

      protected void add(String fieldName, boolean field, String value, Map<String,Object> map)
    • formatTimestamp

      protected String formatTimestamp(long timestamp)
    • setIncludeLevel

      public void setIncludeLevel(boolean includeLevel)
    • setIncludeThreadName

      public void setIncludeThreadName(boolean includeThreadName)
    • setIncludeMDC

      public void setIncludeMDC(boolean includeMDC)
    • setIncludeLoggerName

      public void setIncludeLoggerName(boolean includeLoggerName)
    • setIncludeFormattedMessage

      public void setIncludeFormattedMessage(boolean includeFormattedMessage)
    • setIncludeMessage

      public void setIncludeMessage(boolean includeMessage)
    • setIncludeException

      public void setIncludeException(boolean includeException)
    • setIncludeContextName

      public void setIncludeContextName(boolean includeContextName)
    • setIncludeTimestamp

      public void setIncludeTimestamp(boolean includeTimestamp)
    • setTimestampFormat

      public void setTimestampFormat(String timestampFormat)
    • setTimestampFormatTimezoneId

      public void setTimestampFormatTimezoneId(String timestampFormatTimezoneId)
    • setThrowableHandlingConverter

      public void setThrowableHandlingConverter(ch.qos.logback.classic.pattern.ThrowableHandlingConverter throwableHandlingConverter)