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.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Default setting of packaging data in stack tracesprivate final List
<LoggerContextListener> private LoggerContextVO
private int
private int
private boolean
(package private) int
(package private) final Logger
private int
private final TurboFilterList
Fields inherited from class ch.qos.logback.core.ContextBase
scheduledFutures
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(LoggerContextListener listener) void
addTurboFilter
(TurboFilter newFilter) private void
Check if the named logger exists in the hierarchy.(package private) void
fireOnLevelChange
(Logger logger, Level level) private void
private void
private void
List of packages considered part of the logging framework such that they are never considered as callers of the logging framework.final Logger
final Logger
int
(package private) final FilterReply
getTurboFilterChainDecision_0_3OrMore
(org.slf4j.Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t) (package private) final FilterReply
getTurboFilterChainDecision_1
(org.slf4j.Marker marker, Logger logger, Level level, String format, Object param, Throwable t) (package private) final FilterReply
getTurboFilterChainDecision_2
(org.slf4j.Marker marker, Logger logger, Level level, String format, Object param1, Object param2, Throwable t) private void
incSize()
(package private) void
boolean
(package private) final void
noAppenderDefinedWarning
(Logger logger) void
putProperty
(String key, String val) Set a property of this context.void
removeListener
(LoggerContextListener listener) 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).private void
private void
private void
void
First processPriorToRemoval all registered turbo filters and then clear the registration list.void
setMaxCallerDataDepth
(int maxCallerDataDepth) void
The context name can be set only if it is not already set, or if the current name is the default context name, namely "default", or if the current name and the old name are the same.void
setPackagingDataEnabled
(boolean packagingDataEnabled) (package private) int
size()
void
start()
void
stop()
toString()
private void
A new instance of LoggerContextRemoteView needs to be created each time the name or propertyMap (including keys or values) changes.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
-
Field Details
-
DEFAULT_PACKAGING_DATA
public static final boolean DEFAULT_PACKAGING_DATADefault setting of packaging data in stack traces- See Also:
-
root
-
size
private int size -
noAppenderWarning
private int noAppenderWarning -
loggerContextListenerList
-
loggerCache
-
loggerContextRemoteView
-
turboFilterList
-
packagingDataEnabled
private boolean packagingDataEnabled -
maxCallerDataDepth
private int maxCallerDataDepth -
resetCount
int resetCount -
frameworkPackages
-
-
Constructor Details
-
LoggerContext
public LoggerContext()
-
-
Method Details
-
initEvaluatorMap
void initEvaluatorMap() -
updateLoggerContextVO
private void updateLoggerContextVO()A new instance of LoggerContextRemoteView needs to be created each time the name or propertyMap (including keys or values) changes. -
putProperty
Description copied from interface:Context
Set a property of this context.- Specified by:
putProperty
in interfaceContext
- Overrides:
putProperty
in classContextBase
-
setName
Description copied from class:ContextBase
The context name can be set only if it is not already set, or if the current name is the default context name, namely "default", or if the current name and the old name are the same.- Specified by:
setName
in interfaceContext
- Overrides:
setName
in classContextBase
- Parameters:
name
-
-
getLogger
-
getLogger
- Specified by:
getLogger
in interfaceorg.slf4j.ILoggerFactory
-
incSize
private void incSize() -
size
int size() -
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.
-
noAppenderDefinedWarning
-
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:
reset
in classContextBase
-
cancelScheduledTasks
private void cancelScheduledTasks() -
resetStatusListeners
private void resetStatusListeners() -
getTurboFilterList
-
addTurboFilter
-
resetTurboFilterList
public void resetTurboFilterList()First processPriorToRemoval all registered turbo filters and then clear the registration list. -
getTurboFilterChainDecision_0_3OrMore
-
getTurboFilterChainDecision_1
-
getTurboFilterChainDecision_2
-
addListener
-
removeListener
-
resetListenersExceptResetResistant
private void resetListenersExceptResetResistant() -
resetAllListeners
private void resetAllListeners() -
getCopyOfListenerList
-
fireOnLevelChange
-
fireOnReset
private void fireOnReset() -
fireOnStart
private void fireOnStart() -
fireOnStop
private void fireOnStop() -
start
public void start()- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classContextBase
-
stop
public void stop()- Specified by:
stop
in interfaceLifeCycle
- Overrides:
stop
in classContextBase
-
toString
- Overrides:
toString
in 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
-