Class RootStackTraceElementJsonProvider

All Implemented Interfaces:
ContextAware, FieldNamesAware<LogstashFieldNames>, JsonProvider<ILoggingEvent>

public class RootStackTraceElementJsonProvider extends AbstractFieldJsonProvider<ILoggingEvent> implements FieldNamesAware<LogstashFieldNames>
A JSON provider that, for any log event with a stack trace, adds a root_stack_trace_element JSON object field containing the class name and method name where the outer-most exception was thrown.
Author:
Daniel Albuquerque
  • Field Details

  • Constructor Details

    • RootStackTraceElementJsonProvider

      public RootStackTraceElementJsonProvider()
  • Method Details

    • writeTo

      public void writeTo(JsonGenerator generator, ILoggingEvent event) throws IOException
      Description copied from interface: JsonProvider
      Writes information about the event, to the given generator.

      When called, the generator is assumed to be within a JSON object context (i.e. this provider should write fields and their values to the generator). Upon return, the generator should be within the same JSON object context.

      Specified by:
      writeTo in interface JsonProvider<ILoggingEvent>
      Parameters:
      generator - the JsonGenerator to produce JSON content
      event - the event to convert into JSON
      Throws:
      IOException - if an I/O error occurs
    • setFieldNames

      public void setFieldNames(LogstashFieldNames fieldNames)
      Specified by:
      setFieldNames in interface FieldNamesAware<LogstashFieldNames>
    • setClassFieldName

      public void setClassFieldName(String classFieldName)
    • setMethodFieldName

      public void setMethodFieldName(String methodFieldName)