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.A Logback logging concern is also a
LoggerContext
and can be configured as such.- Author:
- Garret Wilson
-
-
Constructor Summary
Constructors Constructor Description LogbackLoggingConcern()
-
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 io.clogr.logback.LoggerContextLoggingConcern
getLoggerFactory, getRootLogger, setLogLevel
-
-
-
-
Method Detail
-
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
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 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:
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 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:
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 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:
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 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:
GenericConfigurator.doConfigure(InputStream)
, Logback configuration
-
-