Class JsonTemplateLayout

    • Field Detail

      • CONTENT_FORMAT

        private static final java.util.Map<java.lang.String,​java.lang.String> CONTENT_FORMAT
      • charset

        private final java.nio.charset.Charset charset
      • contentType

        private final java.lang.String contentType
      • eventDelimiter

        private final java.lang.String eventDelimiter
    • Method Detail

      • readStackTraceElementTemplate

        private static java.lang.String readStackTraceElementTemplate​(JsonTemplateLayout.Builder builder)
      • readTemplate

        private static java.lang.String readTemplate​(java.lang.String template,
                                                     java.lang.String templateUri,
                                                     java.nio.charset.Charset charset)
      • createContextSupplier

        private static java.util.function.Supplier<JsonTemplateLayout.Context> createContextSupplier​(java.nio.charset.Charset charset,
                                                                                                     JsonWriter jsonWriter)
      • createStringBuilderEncoder

        private static Encoder<java.lang.StringBuilder> createStringBuilderEncoder​(java.nio.charset.Charset charset)
      • toByteArray

        public byte[] toByteArray​(LogEvent event)
        Description copied from interface: Layout
        Formats the event suitable for display.
        Specified by:
        toByteArray in interface Layout<java.lang.String>
        Parameters:
        event - The Logging Event.
        Returns:
        The formatted event.
      • toSerializable

        public java.lang.String toSerializable​(LogEvent event)
        Description copied from interface: Layout
        Formats the event as an Object that can be serialized.
        Specified by:
        toSerializable in interface Layout<java.lang.String>
        Parameters:
        event - The Logging Event.
        Returns:
        The formatted event.
      • encode

        public void encode​(LogEvent event,
                           ByteBufferDestination destination)
        Description copied from interface: Encoder
        Encodes the specified source object to some binary representation and writes the result to the specified destination.
        Specified by:
        encode in interface Encoder<LogEvent>
        Parameters:
        event - the object to encode.
        destination - holds the ByteBuffer to write into.
      • getFooter

        public byte[] getFooter()
        Description copied from interface: Layout
        Returns the format for the layout format.
        Specified by:
        getFooter in interface Layout<java.lang.String>
        Returns:
        The footer.
      • getHeader

        public byte[] getHeader()
        Description copied from interface: Layout
        Returns the header for the layout format.
        Specified by:
        getHeader in interface Layout<java.lang.String>
        Returns:
        The header.
      • getCharset

        public java.nio.charset.Charset getCharset()
        Description copied from interface: StringLayout
        Gets the Charset this layout uses to encode Strings into bytes.
        Specified by:
        getCharset in interface StringLayout
        Returns:
        the Charset this layout uses to encode Strings into bytes.
      • getContentType

        public java.lang.String getContentType()
        Description copied from interface: Layout
        Returns the content type output by this layout. The base class returns "text/plain".
        Specified by:
        getContentType in interface Layout<java.lang.String>
        Returns:
        the content type.
      • getContentFormat

        public java.util.Map<java.lang.String,​java.lang.String> getContentFormat()
        Description copied from interface: Layout
        Returns a description of the content format.
        Specified by:
        getContentFormat in interface Layout<java.lang.String>
        Returns:
        a Map of key/value pairs describing the Layout-specific content format, or an empty Map if no content format descriptors are specified.