Class FluxzeroLogbackAppender
- All Implemented Interfaces:
ch.qos.logback.core.Appender<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.ContextAware, ch.qos.logback.core.spi.FilterAttachable<ch.qos.logback.classic.spi.ILoggingEvent>, ch.qos.logback.core.spi.LifeCycle
This appender inspects log messages for severity WARN or higher and forwards them as ConsoleWarning
or ConsoleError messages to the Fluxzero error gateway, along with detailed metadata such as stack traces, logger
name, and message content.
- See Also:
-
Field Summary
Fields inherited from class ch.qos.logback.core.AppenderBase
name, startedFields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappend(ch.qos.logback.classic.spi.ILoggingEvent event) Processes log events of levelWARNor higher.static voidattach()Attaches this appender to the root logger in the Logback logging context.static voiddetach()Detaches any active instances of this appender from the root logger.protected booleanignoreEvent(ch.qos.logback.classic.spi.ILoggingEvent event) Determines whether the given log event should be ignored.Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, start, stop, toStringMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Constructor Details
-
FluxzeroLogbackAppender
public FluxzeroLogbackAppender()
-
-
Method Details
-
attach
public static void attach()Attaches this appender to the root logger in the Logback logging context.Once attached, the appender will monitor and forward all warning and error logs to the Fluxzero error gateway as
ConsoleWarningorConsoleErrormessages.Typically, this appender is configured automatically via Logback's own configuration. This method exists for dynamic attachment at runtime—e.g., during testing or in environments where programmatic logging configuration is preferred.
-
detach
public static void detach()Detaches any active instances of this appender from the root logger.This is useful for runtime cleanup or reconfiguration.
-
append
protected void append(ch.qos.logback.classic.spi.ILoggingEvent event) Processes log events of levelWARNor higher.Extracts the stack trace and relevant context, transforms the message into a
ConsoleWarningorConsoleError, and sends it to the Fluxzero error gateway.- Specified by:
appendin classch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>- Parameters:
event- the logging event to be processed
-
ignoreEvent
protected boolean ignoreEvent(ch.qos.logback.classic.spi.ILoggingEvent event) Determines whether the given log event should be ignored.Events marked with
ClientUtils.ignoreMarkerwill be skipped and not sent to Fluxzero.- Parameters:
event- the logging event to check- Returns:
trueif the event should be ignored,falseotherwise
-