Top Description Fields Constructors Methods
ch.qos.logback.classic

public Class LoggerContext

extends ContextBase
implements ILoggerFactory, LifeCycle
Class Inheritance
All Implemented Interfaces
ch.qos.logback.core.spi.LifeCycle, org.slf4j.ILoggerFactory
Static Imports
ch.qos.logback.core.CoreConstants.EVALUATOR_MAP

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

Modifier and TypeField and Description
public static final boolean
DEFAULT_PACKAGING_DATA

Default setting of packaging data in stack traces

private List<String>
private Map<String, Logger>
private final List<LoggerContextListener>
private LoggerContextVO
private int
pack-priv MDCAdapter
private int
private boolean
pack-priv int
pack-priv final Logger
pack-priv SequenceNumberGenerator
private int
private final TurboFilterList
Inherited from ch.qos.logback.core.ContextBase:
scheduledFutures

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public void
private void
public Logger
exists(String
the name of the logger to search for.
name
)

Check if the named logger exists in the hierarchy.

pack-priv void
private void
private void
private void
public List<LoggerContextListener>
public List<String>

Returns:

list of framework packages
getFrameworkPackages
()

List of packages considered part of the logging framework such that they are never considered as callers of the logging framework.

public final Logger
getLogger(final Class<?> clazz)

public Logger
getLogger(final String
the name of the Logger to return
name
)

Implements org.slf4j.ILoggerFactory.getLogger.

Return an appropriate Logger instance as specified by the name parameter.
public LoggerContextVO
public List<Logger>
public int
public MDCAdapter
public SequenceNumberGenerator
pack-priv final FilterReply
getTurboFilterChainDecision_0_3OrMore(final Marker marker, final Logger logger, final Level level, final String format, final Object[] params, final Throwable t)

pack-priv final FilterReply
getTurboFilterChainDecision_1(final Marker marker, final Logger logger, final Level level, final String format, final Object param, final Throwable t)

pack-priv final FilterReply
getTurboFilterChainDecision_2(final Marker marker, final Logger logger, final Level level, final String format, final Object param1, final Object param2, final Throwable t)

public TurboFilterList
private void
pack-priv void
public boolean
pack-priv final void
public void
public void
public void
reset()

Overrides ch.qos.logback.core.ContextBase.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
public void
resetTurboFilterList()

First processPriorToRemoval all registered turbo filters and then clear the registration list.

public void
setMaxCallerDataDepth(int maxCallerDataDepth)

public void
public void
setName(String name)

Overrides ch.qos.logback.core.ContextBase.setName.

Implements ch.qos.logback.core.Context.setName.

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.
public void
setPackagingDataEnabled(boolean packagingDataEnabled)

public void
pack-priv int
size()

public void
public void
public String
toString()

Overrides ch.qos.logback.core.ContextBase.toString.

Returns a string representation of the object.
private void
updateLoggerContextVO()

A new instance of LoggerContextRemoteView needs to be created each time the name or propertyMap (including keys or values) changes.

Inherited from ch.qos.logback.core.ContextBase:
addConfigurationEventListeneraddScheduledFutureaddSubstitutionPropertyfireConfigurationEventgetAlternateExecutorServicegetBirthTimegetConfigurationLockgetCopyOfPropertyMapgetCopyOfScheduledFuturesgetExecutorServicegetNamegetObjectgetPropertygetScheduledExecutorServicegetScheduledFuturesgetStatusManagerinitCollisionMapsisStartedputObjectregisterremoveObjectsetStatusManager

Field Detail

DEFAULT_PACKAGING_DATAback to summary
public static final boolean DEFAULT_PACKAGING_DATA

Default setting of packaging data in stack traces

frameworkPackagesback to summary
private List<String> frameworkPackages
loggerCacheback to summary
private Map<String, Logger> loggerCache
loggerContextListenerListback to summary
private final List<LoggerContextListener> loggerContextListenerList
loggerContextRemoteViewback to summary
private LoggerContextVO loggerContextRemoteView
maxCallerDataDepthback to summary
private int maxCallerDataDepth
mdcAdapterback to summary
pack-priv MDCAdapter mdcAdapter
noAppenderWarningback to summary
private int noAppenderWarning
packagingDataEnabledback to summary
private boolean packagingDataEnabled
resetCountback to summary
pack-priv int resetCount
rootback to summary
pack-priv final Logger root
sequenceNumberGeneratorback to summary
pack-priv SequenceNumberGenerator sequenceNumberGenerator

Hides ch.qos.logback.core.ContextBase.sequenceNumberGenerator.

sizeback to summary
private int size
turboFilterListback to summary
private final TurboFilterList turboFilterList

Constructor Detail

LoggerContextback to summary
public LoggerContext()

Method Detail

addListenerback to summary
public void addListener(LoggerContextListener listener)
addTurboFilterback to summary
public void addTurboFilter(TurboFilter newFilter)
cancelScheduledTasksback to summary
private void cancelScheduledTasks()
existsback to summary
public Logger exists(String name)

Check if the named logger exists in the hierarchy. If so return its reference, otherwise returns null.

Parameters
name:String

the name of the logger to search for.

fireOnLevelChangeback to summary
pack-priv void fireOnLevelChange(Logger logger, Level level)
fireOnResetback to summary
private void fireOnReset()
fireOnStartback to summary
private void fireOnStart()
fireOnStopback to summary
private void fireOnStop()
getCopyOfListenerListback to summary
public List<LoggerContextListener> getCopyOfListenerList()
getFrameworkPackagesback to summary
public List<String> 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<String>

list of framework packages

getLoggerback to summary
public final Logger getLogger(final Class<?> clazz)
getLoggerback to summary
public Logger getLogger(final String name)

Implements org.slf4j.ILoggerFactory.getLogger.

Doc from org.slf4j.ILoggerFactory.getLogger.

Return an appropriate Logger instance as specified by the name parameter.

If the name parameter is equal to Logger#ROOT_LOGGER_NAME, that is the string value "ROOT" (case insensitive), then the root logger of the underlying logging system is returned.

Null-valued name arguments are considered invalid.

Certain extremely simple logging systems, e.g. NOP, may always return the same logger instance regardless of the requested name.

Parameters
name:String

the name of the Logger to return

Returns:Logger

a Logger instance

Annotations
@Override
getLoggerContextRemoteViewback to summary
public LoggerContextVO getLoggerContextRemoteView()
getLoggerListback to summary
public List<Logger> getLoggerList()
getMaxCallerDataDepthback to summary
public int getMaxCallerDataDepth()
getMDCAdapterback to summary
public MDCAdapter getMDCAdapter()
getSequenceNumberGeneratorback to summary
public SequenceNumberGenerator getSequenceNumberGenerator()

Overrides ch.qos.logback.core.ContextBase.getSequenceNumberGenerator.

Implements ch.qos.logback.core.Context.getSequenceNumberGenerator.

Annotations
@Override
getTurboFilterChainDecision_0_3OrMoreback to summary
pack-priv final FilterReply getTurboFilterChainDecision_0_3OrMore(final Marker marker, final Logger logger, final Level level, final String format, final Object[] params, final Throwable t)
getTurboFilterChainDecision_1back to summary
pack-priv final FilterReply getTurboFilterChainDecision_1(final Marker marker, final Logger logger, final Level level, final String format, final Object param, final Throwable t)
getTurboFilterChainDecision_2back to summary
pack-priv final FilterReply getTurboFilterChainDecision_2(final Marker marker, final Logger logger, final Level level, final String format, final Object param1, final Object param2, final Throwable t)
getTurboFilterListback to summary
public TurboFilterList getTurboFilterList()
incSizeback to summary
private void incSize()
initEvaluatorMapback to summary
pack-priv void initEvaluatorMap()
isPackagingDataEnabledback to summary
public boolean isPackagingDataEnabled()
noAppenderDefinedWarningback to summary
pack-priv final void noAppenderDefinedWarning(final Logger logger)
putPropertyback to summary
public void putProperty(String key, String val)

Overrides ch.qos.logback.core.ContextBase.putProperty.

Implements ch.qos.logback.core.Context.putProperty.

Doc from ch.qos.logback.core.Context.putProperty.

Set a property of this context.

Annotations
@Override
removeListenerback to summary
public void removeListener(LoggerContextListener listener)
resetback to summary
public void reset()

Overrides ch.qos.logback.core.ContextBase.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.

Annotations
@Override
resetAllListenersback to summary
private void resetAllListeners()
resetListenersExceptResetResistantback to summary
private void resetListenersExceptResetResistant()
resetStatusListenersExceptResetResistantback to summary
private void resetStatusListenersExceptResetResistant()
resetTurboFilterListback to summary
public void resetTurboFilterList()

First processPriorToRemoval all registered turbo filters and then clear the registration list.

setMaxCallerDataDepthback to summary
public void setMaxCallerDataDepth(int maxCallerDataDepth)
setMDCAdapterback to summary
public void setMDCAdapter(MDCAdapter anAdapter)
setNameback to summary
public void setName(String name)

Overrides ch.qos.logback.core.ContextBase.setName.

Implements ch.qos.logback.core.Context.setName.

Doc from ch.qos.logback.core.ContextBase.setName.

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.

Annotations
@Override
setPackagingDataEnabledback to summary
public void setPackagingDataEnabled(boolean packagingDataEnabled)
setSequenceNumberGeneratorback to summary
public void setSequenceNumberGenerator(SequenceNumberGenerator sng)

Overrides ch.qos.logback.core.ContextBase.setSequenceNumberGenerator.

Implements ch.qos.logback.core.Context.setSequenceNumberGenerator.

Annotations
@Override
sizeback to summary
pack-priv int size()
startback to summary
public void start()

Overrides ch.qos.logback.core.ContextBase.start.

Implements ch.qos.logback.core.spi.LifeCycle.start.

Annotations
@Override
stopback to summary
public void stop()

Overrides ch.qos.logback.core.ContextBase.stop.

Implements ch.qos.logback.core.spi.LifeCycle.stop.

toStringback to summary
public String toString()

Overrides ch.qos.logback.core.ContextBase.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
updateLoggerContextVOback to summary
private void updateLoggerContextVO()

A new instance of LoggerContextRemoteView needs to be created each time the name or propertyMap (including keys or values) changes.