Class LogbackLoggingConcern

  • All Implemented Interfaces:
    ch.qos.logback.core.Context, ch.qos.logback.core.spi.LifeCycle, ch.qos.logback.core.spi.PropertyContainer, LoggerContextLoggingConcern, io.clogr.LoggingConcern, io.csar.Concern, org.slf4j.ILoggerFactory

    public class LogbackLoggingConcern
    extends ch.qos.logback.classic.LoggerContext
    implements LoggerContextLoggingConcern
    A concern for logging configurations backed by Logback.

    A Logback logging concern is also a LoggerContext and can be configured as such.

    Author:
    Garret Wilson
    • Field Summary

      • Fields inherited from class ch.qos.logback.classic.LoggerContext

        DEFAULT_PACKAGING_DATA
      • Fields inherited from class ch.qos.logback.core.ContextBase

        scheduledFutures
      • Fields inherited from interface io.clogr.LoggingConcern

        DEFAULT
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      LogbackLoggingConcern autoConfigure()
      Automatically configures this logging concern.
      LogbackLoggingConcern configure​(java.io.File file)
      Configures this logging concern from a Logback configuration file.
      LogbackLoggingConcern configure​(java.io.InputStream inputStream)
      Configures this logging concern from a Logback configuration file from a specified input stream.
      LogbackLoggingConcern configure​(java.net.URL url)
      Configures this logging concern from a Logback configuration file at a specified URL.
      LogbackLoggingConcern configure​(java.nio.file.Path path)
      Configures this logging concern from a Logback configuration file at a specified path.
      ch.qos.logback.classic.LoggerContext getLoggerContext()  
      • Methods inherited from class ch.qos.logback.classic.LoggerContext

        addListener, addTurboFilter, exists, getCopyOfListenerList, getFrameworkPackages, getLogger, getLogger, getLoggerContextRemoteView, getLoggerList, getMaxCallerDataDepth, getTurboFilterList, isPackagingDataEnabled, putProperty, removeListener, reset, resetTurboFilterList, setMaxCallerDataDepth, setName, setPackagingDataEnabled, start, stop, toString
      • Methods inherited from class ch.qos.logback.core.ContextBase

        addScheduledFuture, getBirthTime, getConfigurationLock, getCopyOfPropertyMap, getExecutorService, getName, getObject, getProperty, getScheduledExecutorService, getScheduledFutures, getStatusManager, initCollisionMaps, isStarted, putObject, register, removeObject, setStatusManager
      • 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.LifeCycle

        isStarted
      • Methods inherited from interface io.clogr.LoggingConcern

        getConcernType, getLogger, setLogLevel
    • Constructor Detail

      • LogbackLoggingConcern

        public LogbackLoggingConcern()
    • Method Detail

      • getLoggerContext

        public ch.qos.logback.classic.LoggerContext getLoggerContext()
        Specified by:
        getLoggerContext in interface LoggerContextLoggingConcern
        Returns:
        The Logback logger context this logging concern is associated with.
      • autoConfigure

        public LogbackLoggingConcern autoConfigure()
                                            throws ch.qos.logback.core.joran.spi.JoranException
        Automatically configures this logging concern.

        This automatic configuration is equivalent to the configuration performed by a default Logback installation independent of Clogr.

        Returns:
        This logging concern; useful for chaining configuration commands.
        Throws:
        ch.qos.logback.core.joran.spi.JoranException - if an error occurred during configuration;
      • configure

        public LogbackLoggingConcern configure​(@Nonnull
                                               java.nio.file.Path path)
                                        throws ch.qos.logback.core.joran.spi.JoranException
        Configures this logging concern from a Logback configuration file at a specified path.

        If this logging concern previously had a configuration that you want to replace, you must first call LoggerContext.reset(). A multi-step configuration must not call LoggerContext.reset() between each step.

        Parameters:
        path - The path to the Logback configuration file.
        Returns:
        This logging concern; useful for chaining configuration commands.
        Throws:
        ch.qos.logback.core.joran.spi.JoranException - if an error occurred during configuration;
        See Also:
        GenericConfigurator.doConfigure(File), Logback configuration
      • configure

        public LogbackLoggingConcern configure​(@Nonnull
                                               java.io.File file)
                                        throws ch.qos.logback.core.joran.spi.JoranException
        Configures this logging concern from a Logback configuration file.

        If this logging concern previously had a configuration that you want to replace, you must first call LoggerContext.reset(). A multi-step configuration must not call LoggerContext.reset() between each step.

        Parameters:
        file - The Logback configuration file.
        Returns:
        This logging concern; useful for chaining configuration commands.
        Throws:
        ch.qos.logback.core.joran.spi.JoranException - if an error occurred during configuration;
        See Also:
        GenericConfigurator.doConfigure(File), Logback configuration
      • configure

        public LogbackLoggingConcern configure​(@Nonnull
                                               java.net.URL url)
                                        throws ch.qos.logback.core.joran.spi.JoranException
        Configures this logging concern from a Logback configuration file at a specified URL.

        If this logging concern previously had a configuration that you want to replace, you must first call LoggerContext.reset(). A multi-step configuration must not call LoggerContext.reset() between each step.

        Parameters:
        url - The URL to the Logback configuration file.
        Returns:
        This logging concern; useful for chaining configuration commands.
        Throws:
        ch.qos.logback.core.joran.spi.JoranException - if an error occurred during configuration;
        See Also:
        GenericConfigurator.doConfigure(URL), Logback configuration
      • configure

        public LogbackLoggingConcern configure​(@Nonnull
                                               java.io.InputStream inputStream)
                                        throws ch.qos.logback.core.joran.spi.JoranException
        Configures this logging concern from a Logback configuration file from a specified input stream.

        If this logging concern previously had a configuration that you want to replace, you must first call LoggerContext.reset(). A multi-step configuration must not call LoggerContext.reset() between each step.

        Parameters:
        inputStream - The input stream to the Logback configuration file.
        Returns:
        This logging concern; useful for chaining configuration commands.
        Throws:
        ch.qos.logback.core.joran.spi.JoranException - if an error occurred during configuration;
        See Also:
        GenericConfigurator.doConfigure(InputStream), Logback configuration