Class EcsEncoder

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

    public class EcsEncoder
    extends ch.qos.logback.core.encoder.EncoderBase<ch.qos.logback.classic.spi.ILoggingEvent>
    • Constructor Detail

      • EcsEncoder

        public EcsEncoder()
    • Method Detail

      • headerBytes

        public byte[] headerBytes()
      • start

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

        public void init​(OutputStream os)
        This method has been removed in logback 1.2. To make this lib backwards compatible with logback 1.1 we have implement this method.
      • doEncode

        public void doEncode​(Object event)
                      throws IOException
        This method has been removed in logback 1.2. To make this lib backwards compatible with logback 1.1 we have implement this method. However, since we compile with 1.2.x, this method is not compiled as an interface method, which means that there won't be type erasure. Therefore, we must use a Object argument for it to be compatible with 1.1.x.
        Throws:
        IOException
      • close

        public void close()
                   throws IOException
        This method has been removed in logback 1.2. To make this lib backwards compatible with logback 1.1 we have implement this method.
        Throws:
        IOException
      • encode

        public byte[] encode​(ch.qos.logback.classic.spi.ILoggingEvent event)
      • addCustomFields

        protected void addCustomFields​(ch.qos.logback.classic.spi.ILoggingEvent event,
                                       StringBuilder builder)
        Subclasses can override this to add custom fields. The last character in the StringBuilder will be comma when this is called. You must add a comma after each custom field.
      • footerBytes

        public byte[] footerBytes()
      • setServiceName

        public void setServiceName​(String serviceName)
      • setServiceNodeName

        public void setServiceNodeName​(String serviceNodeName)
      • setIncludeMarkers

        public void setIncludeMarkers​(boolean includeMarkers)
      • setStackTraceAsArray

        public void setStackTraceAsArray​(boolean stackTraceAsArray)
      • setIncludeOrigin

        public void setIncludeOrigin​(boolean includeOrigin)
      • addAdditionalField

        public void addAdditionalField​(AdditionalField pair)
      • setEventDataset

        public void setEventDataset​(String eventDataset)