Package ch.qos.logback.classic
Class LoggerContext
java.lang.Object
ch.qos.logback.core.ContextBase
ch.qos.logback.classic.LoggerContext
- All Implemented Interfaces:
Context,LifeCycle,PropertyContainer,org.slf4j.ILoggerFactory
LoggerContext glues many of the logback-classic components together. In
principle, every logback-classic component instance is attached either
directly or indirectly to a LoggerContext instance. Just as importantly
LoggerContext implements the
ILoggerFactory acting as the
manufacturing source of Logger instances.- Author:
- Ceki Gulcu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic booleanDefault setting of packaging data in stack tracesFields inherited from class ch.qos.logback.core.ContextBase
scheduledFutures -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(LoggerContextListener listener)voidaddTurboFilter(TurboFilter newFilter)Check if the named logger exists in the hierarchy.List of packages considered part of the logging framework such that they are never considered as callers of the logging framework.intbooleanvoidputProperty(String key, String val)voidremoveListener(LoggerContextListener listener)voidreset()This method clears all internal properties, except internal status messages, closes all appenders, removes any turboFilters, fires an OnReset event, removes all status listeners, removes all context listeners (except those which are reset resistant).voidFirst processPriorToRemoval all registered turbo filters and then clear the registration list.voidsetMaxCallerDataDepth(int maxCallerDataDepth)voidvoidsetPackagingDataEnabled(boolean packagingDataEnabled)voidstart()voidstop()toString()Methods inherited from class ch.qos.logback.core.ContextBase
addScheduledFuture, getBirthTime, getConfigurationLock, getCopyOfPropertyMap, getCopyOfScheduledFutures, getExecutorService, getName, getObject, getProperty, getScheduledExecutorService, getScheduledFutures, getStatusManager, initCollisionMaps, isStarted, putObject, register, removeObject, setSequenceNumberGenerator, setStatusManager
-
Field Details
-
DEFAULT_PACKAGING_DATA
public static final boolean DEFAULT_PACKAGING_DATADefault setting of packaging data in stack traces- See Also:
- Constant Field Values
-
-
Constructor Details
-
LoggerContext
public LoggerContext()
-
-
Method Details
-
putProperty
- Specified by:
putPropertyin interfaceContext- Overrides:
putPropertyin classContextBase
-
setName
- Specified by:
setNamein interfaceContext- Overrides:
setNamein classContextBase
-
getLogger
-
getLogger
- Specified by:
getLoggerin interfaceorg.slf4j.ILoggerFactory
-
exists
Check if the named logger exists in the hierarchy. If so return its reference, otherwise returnsnull.- Parameters:
name- the name of the logger to search for.
-
getLoggerList
-
getLoggerContextRemoteView
-
setPackagingDataEnabled
public void setPackagingDataEnabled(boolean packagingDataEnabled) -
isPackagingDataEnabled
public boolean isPackagingDataEnabled() -
reset
public void reset()This method clears all internal properties, except internal status messages, closes all appenders, removes any turboFilters, fires an OnReset event, removes all status listeners, removes all context listeners (except those which are reset resistant). As mentioned above, internal status messages survive resets.- Overrides:
resetin classContextBase
-
getTurboFilterList
-
addTurboFilter
-
resetTurboFilterList
public void resetTurboFilterList()First processPriorToRemoval all registered turbo filters and then clear the registration list. -
addListener
-
removeListener
-
getCopyOfListenerList
-
start
public void start()- Specified by:
startin interfaceLifeCycle- Overrides:
startin classContextBase
-
stop
public void stop()- Specified by:
stopin interfaceLifeCycle- Overrides:
stopin classContextBase
-
toString
- Overrides:
toStringin classContextBase
-
getMaxCallerDataDepth
public int getMaxCallerDataDepth() -
setMaxCallerDataDepth
public void setMaxCallerDataDepth(int maxCallerDataDepth) -
getFrameworkPackages
List of packages considered part of the logging framework such that they are never considered as callers of the logging framework. This list used to compute the caller for logging events. To designate package "com.foo" as well as all its subpackages as being part of the logging framework, simply add "com.foo" to this list.- Returns:
- list of framework packages
-
getSequenceNumberGenerator
- Specified by:
getSequenceNumberGeneratorin interfaceContext- Overrides:
getSequenceNumberGeneratorin classContextBase
-