Package io.clogr.logback
Class LogbackLoggingConcern
java.lang.Object
ch.qos.logback.core.ContextBase
ch.qos.logback.classic.LoggerContext
io.clogr.logback.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.
- Author:
- Garret Wilson
- API Note:
- This logging concern is for manual, programmatic configuration. It is not a default logging concern that delegates to the existing Logback SLF4J
configuration., A Logback logging concern is also a
LoggerContext
and can be configured as such. However note that as of Logback 1.3.0-alpha4 Logback no longer supports theContextSelector
mechanism for logging separation.
-
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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAutomatically configures this logging concern.Configures this logging concern from a Logback configuration file.configure
(InputStream inputStream) Configures this logging concern from a Logback configuration file from a specified input stream.Configures this logging concern from a Logback configuration file at a specified URL.Configures this logging concern from a Logback configuration file at a specified path.ch.qos.logback.classic.LoggerContext
Methods inherited from class ch.qos.logback.classic.LoggerContext
addListener, addTurboFilter, exists, getCopyOfListenerList, getFrameworkPackages, getLogger, getLogger, getLoggerContextRemoteView, getLoggerList, getMaxCallerDataDepth, getMDCAdapter, getSequenceNumberGenerator, getTurboFilterList, isPackagingDataEnabled, putProperty, removeListener, reset, resetTurboFilterList, setMaxCallerDataDepth, setMDCAdapter, setName, setPackagingDataEnabled, setSequenceNumberGenerator, start, stop, toString
Methods inherited from class ch.qos.logback.core.ContextBase
addConfigurationEventListener, addScheduledFuture, fireConfigurationEvent, getBirthTime, getConfigurationLock, getCopyOfPropertyMap, getCopyOfScheduledFutures, 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.logback.LoggerContextLoggingConcern
getLoggerFactory, getRootLogger, setLogLevel
Methods inherited from interface io.clogr.LoggingConcern
getConcernType, getLogger, setLogLevel
-
Constructor Details
-
LogbackLoggingConcern
public LogbackLoggingConcern()
-
-
Method Details
-
getLoggerContext
public ch.qos.logback.classic.LoggerContext getLoggerContext()- Specified by:
getLoggerContext
in interfaceLoggerContextLoggingConcern
- Returns:
- The Logback logger context this logging concern is associated with.
-
autoConfigure
Automatically configures this logging concern.- API Note:
- 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 Path path) throws ch.qos.logback.core.joran.spi.JoranException Configures this logging concern from a Logback configuration file at a specified path.- API Note:
- 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 callLoggerContext.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:
-
GenericXMLConfigurator.doConfigure(File)
- Logback configuration
-
configure
public LogbackLoggingConcern configure(@Nonnull File file) throws ch.qos.logback.core.joran.spi.JoranException Configures this logging concern from a Logback configuration file.- API Note:
- 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 callLoggerContext.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:
-
GenericXMLConfigurator.doConfigure(File)
- Logback configuration
-
configure
public LogbackLoggingConcern configure(@Nonnull URL url) throws ch.qos.logback.core.joran.spi.JoranException Configures this logging concern from a Logback configuration file at a specified URL.- API Note:
- 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 callLoggerContext.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:
-
GenericXMLConfigurator.doConfigure(URL)
- Logback configuration
-
configure
public LogbackLoggingConcern configure(@Nonnull InputStream inputStream) throws ch.qos.logback.core.joran.spi.JoranException Configures this logging concern from a Logback configuration file from a specified input stream.- API Note:
- 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 callLoggerContext.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:
-
GenericXMLConfigurator.doConfigure(InputStream)
- Logback configuration
-