Class FluxCapacitorLogbackAppender

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
io.fluxcapacitor.javaclient.common.logging.FluxCapacitorLogbackAppender
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

public class FluxCapacitorLogbackAppender extends ch.qos.logback.core.AppenderBase<ch.qos.logback.classic.spi.ILoggingEvent>
A Logback-compatible appender that automatically publishes warning and error-level log events to the Flux Capacitor platform.

This appender inspects log messages for severity WARN or higher and forwards them as ConsoleWarning or ConsoleError messages to the Flux 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, started

    Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

    context
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    append(ch.qos.logback.classic.spi.ILoggingEvent event)
    Processes log events of level WARN or higher.
    static void
    Attaches this appender to the root logger in the Logback logging context.
    static void
    Detaches any active instances of this appender from the root logger.
    protected boolean
    ignoreEvent(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, toString

    Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

    addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface ch.qos.logback.core.spi.ContextAware

    addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
  • Constructor Details

    • FluxCapacitorLogbackAppender

      public FluxCapacitorLogbackAppender()
  • 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 Flux error gateway as ConsoleWarning or ConsoleError messages.

      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 level WARN or higher.

      Extracts the stack trace and relevant context, transforms the message into a ConsoleWarning or ConsoleError, and sends it to the Flux error gateway.

      Specified by:
      append in class ch.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.ignoreMarker will be skipped and not sent to Flux.

      Parameters:
      event - the logging event to check
      Returns:
      true if the event should be ignored, false otherwise