Class SentryAppender

java.lang.Object
org.apache.logging.log4j.core.AbstractLifeCycle
org.apache.logging.log4j.core.filter.AbstractFilterable
org.apache.logging.log4j.core.appender.AbstractAppender
io.sentry.log4j2.SentryAppender
All Implemented Interfaces:
org.apache.logging.log4j.core.Appender, org.apache.logging.log4j.core.filter.Filterable, org.apache.logging.log4j.core.impl.LocationAware, org.apache.logging.log4j.core.LifeCycle, org.apache.logging.log4j.core.LifeCycle2

@Plugin(name="Sentry", category="Core", elementType="appender", printObject=true) public class SentryAppender extends org.apache.logging.log4j.core.appender.AbstractAppender
Appender for Log4j2 in charge of sending the logged events to a Sentry server.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.apache.logging.log4j.core.appender.AbstractAppender

    org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B extends org.apache.logging.log4j.core.appender.AbstractAppender.Builder<B>>

    Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle

    org.apache.logging.log4j.core.LifeCycle.State
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle

    DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER

    Fields inherited from interface org.apache.logging.log4j.core.Appender

    ELEMENT_TYPE, EMPTY_ARRAY
  • Constructor Summary

    Constructors
    Constructor
    Description
    SentryAppender(@NotNull String name, @Nullable org.apache.logging.log4j.core.Filter filter, @Nullable String dsn, @Nullable org.apache.logging.log4j.Level minimumBreadcrumbLevel, @Nullable org.apache.logging.log4j.Level minimumEventLevel, @Nullable Boolean debug, @Nullable ITransportFactory transportFactory, @NotNull IHub hub, @Nullable String[] contextTags)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    append(@NotNull org.apache.logging.log4j.core.LogEvent eventObject)
     
    static @Nullable SentryAppender
    createAppender(@Nullable String name, @Nullable org.apache.logging.log4j.Level minimumBreadcrumbLevel, @Nullable org.apache.logging.log4j.Level minimumEventLevel, @Nullable String dsn, @Nullable Boolean debug, @Nullable org.apache.logging.log4j.core.Filter filter, @Nullable String contextTags)
    Create a Sentry Appender.
    protected @NotNull Breadcrumb
    createBreadcrumb(@NotNull org.apache.logging.log4j.core.LogEvent loggingEvent)
    Creates Breadcrumb from log4j2 LogEvent.
    protected @NotNull SentryEvent
    createEvent(@NotNull org.apache.logging.log4j.core.LogEvent loggingEvent)
    Creates SentryEvent from Log4j2 LogEvent.
    void
     

    Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender

    error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString

    Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable

    addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stop, stop

    Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle

    equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.logging.log4j.core.LifeCycle

    getState, initialize, isStarted, isStopped, stop
  • Field Details

  • Constructor Details

    • SentryAppender

      public SentryAppender(@NotNull @NotNull String name, @Nullable @Nullable org.apache.logging.log4j.core.Filter filter, @Nullable @Nullable String dsn, @Nullable @Nullable org.apache.logging.log4j.Level minimumBreadcrumbLevel, @Nullable @Nullable org.apache.logging.log4j.Level minimumEventLevel, @Nullable @Nullable Boolean debug, @Nullable @Nullable ITransportFactory transportFactory, @NotNull @NotNull IHub hub, @Nullable @Nullable String[] contextTags)
  • Method Details

    • createAppender

      @PluginFactory @Nullable public static @Nullable SentryAppender createAppender(@Nullable @PluginAttribute("name") @Nullable String name, @Nullable @PluginAttribute("minimumBreadcrumbLevel") @Nullable org.apache.logging.log4j.Level minimumBreadcrumbLevel, @Nullable @PluginAttribute("minimumEventLevel") @Nullable org.apache.logging.log4j.Level minimumEventLevel, @Nullable @PluginAttribute("dsn") @Nullable String dsn, @Nullable @PluginAttribute("debug") @Nullable Boolean debug, @Nullable @PluginElement("filter") @Nullable org.apache.logging.log4j.core.Filter filter, @Nullable @PluginAttribute("contextTags") @Nullable String contextTags)
      Create a Sentry Appender.
      Parameters:
      name - The name of the Appender.
      minimumBreadcrumbLevel - The min. level of the breadcrumb.
      minimumEventLevel - The min. level of the event.
      dsn - the Sentry DSN.
      debug - if Sentry debug mode should be on
      filter - The filter, if any, to use.
      Returns:
      The SentryAppender.
    • start

      public void start()
      Specified by:
      start in interface org.apache.logging.log4j.core.LifeCycle
      Overrides:
      start in class org.apache.logging.log4j.core.filter.AbstractFilterable
    • append

      public void append(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent eventObject)
    • createEvent

      @NotNull protected @NotNull SentryEvent createEvent(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent loggingEvent)
      Creates SentryEvent from Log4j2 LogEvent.
      Parameters:
      loggingEvent - the log4j2 event
      Returns:
      the sentry event
    • createBreadcrumb

      @NotNull protected @NotNull Breadcrumb createBreadcrumb(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent loggingEvent)
      Creates Breadcrumb from log4j2 LogEvent.
      Parameters:
      loggingEvent - the log4j2 event
      Returns:
      the sentry breadcrumb