Package io.sentry.log4j2
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
FieldsFields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGERFields inherited from interface org.apache.logging.log4j.core.Appender
ELEMENT_TYPE, EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionSentryAppender(@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 io.sentry.ITransportFactory transportFactory, @NotNull io.sentry.IScopes scopes, @Nullable String[] contextTags) Deprecated.This constructor is deprecated.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 org.apache.logging.log4j.Level minimumLevel, @Nullable Boolean debug, @Nullable io.sentry.ITransportFactory transportFactory, @NotNull io.sentry.IScopes scopes, @Nullable String[] contextTags) -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(@NotNull org.apache.logging.log4j.core.LogEvent eventObject) protected voidcaptureLog(@NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) Captures a Sentry log from Log4j2'sLogEvent.static @Nullable SentryAppendercreateAppender(@Nullable String name, @Nullable org.apache.logging.log4j.Level minimumBreadcrumbLevel, @Nullable org.apache.logging.log4j.Level minimumEventLevel, @Nullable org.apache.logging.log4j.Level minimumLevel, @Nullable String dsn, @Nullable Boolean debug, @Nullable org.apache.logging.log4j.core.Filter filter, @Nullable String contextTags) Create a Sentry Appender.protected @NotNull io.sentry.BreadcrumbcreateBreadcrumb(@NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) CreatesBreadcrumbfrom log4j2LogEvent.protected @NotNull io.sentry.SentryEventcreateEvent(@NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) CreatesSentryEventfrom Log4j2LogEvent.voidstart()Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toStringMethods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter, stop, stopMethods 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, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.logging.log4j.core.LifeCycle
getState, initialize, isStarted, isStopped, stop
-
Field Details
-
MECHANISM_TYPE
- See Also:
-
-
Constructor Details
-
SentryAppender
@Deprecated 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 io.sentry.ITransportFactory transportFactory, @NotNull @NotNull io.sentry.IScopes scopes, @Nullable @Nullable String[] contextTags) Deprecated.This constructor is deprecated. Please useSentryAppender(String, Filter, String, Level, Level, Level, Boolean, ITransportFactory, IScopes, String[])instead. -
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 org.apache.logging.log4j.Level minimumLevel, @Nullable @Nullable Boolean debug, @Nullable @Nullable io.sentry.ITransportFactory transportFactory, @NotNull @NotNull io.sentry.IScopes scopes, @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("minimumLevel") @Nullable org.apache.logging.log4j.Level minimumLevel, @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.minimumLevel- The min. level of the log event.dsn- the Sentry DSN.debug- if Sentry debug mode should be onfilter- The filter, if any, to use.- Returns:
- The SentryAppender.
-
start
public void start()- Specified by:
startin interfaceorg.apache.logging.log4j.core.LifeCycle- Overrides:
startin classorg.apache.logging.log4j.core.filter.AbstractFilterable
-
append
public void append(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent eventObject) -
captureLog
protected void captureLog(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) Captures a Sentry log from Log4j2'sLogEvent.- Parameters:
loggingEvent- the log4j2 event
-
createEvent
@NotNull protected @NotNull io.sentry.SentryEvent createEvent(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) CreatesSentryEventfrom Log4j2LogEvent.- Parameters:
loggingEvent- the log4j2 event- Returns:
- the sentry event
-
createBreadcrumb
@NotNull protected @NotNull io.sentry.Breadcrumb createBreadcrumb(@NotNull @NotNull org.apache.logging.log4j.core.LogEvent loggingEvent) CreatesBreadcrumbfrom log4j2LogEvent.- Parameters:
loggingEvent- the log4j2 event- Returns:
- the sentry breadcrumb
-