Logback API
Version 0.9.8

ch.qos.logback.classic
Class LoggerContext

java.lang.Object
  extended by ch.qos.logback.core.ContextBase
      extended by ch.qos.logback.classic.LoggerContext
All Implemented Interfaces:
TurboFilterAttachable, Context, LifeCycle, ILoggerFactory

public class LoggerContext
extends ContextBase
implements ILoggerFactory, TurboFilterAttachable, LifeCycle

LoggerContext glues many of the logback-classic components together. In principle, every logback-classic component instance is attached either directly or indirecty to a LoggerContext instance. Just as importantly LoggerContext implements the ILoggerFactory acting as the manufacturing source of Logger instances.

Author:
Ceki Gulcu

Field Summary
static String ROOT_NAME
           
 
Constructor Summary
LoggerContext()
           
 
Method Summary
 void addListener(ContextListener listener)
           
 void addTurboFilter(TurboFilter newFilter)
          Add a filter.
 void clearAllTurboFilters()
           
 Logger exists(String name)
          Check if the named logger exists in the hierarchy.
 TurboFilter getFirstTurboFilter()
          Get first filter in the chain.
 Logger getLogger(Class clazz)
           
 Logger getLogger(String name)
           
 LoggerContextRemoteView getLoggerContextRemoteView()
           
 List<Logger> getLoggerList()
           
 FilterReply getTurboFilterChainDecision(Marker marker, Logger logger, Level level, String format, Object[] params, Throwable t)
          Loop through the filters in the chain.
 FilterReply getTurboFilterChainDecision(Marker marker, Logger logger, Level level, String format, Object param1, Object param2, Throwable t)
           
 FilterReply getTurboFilterChainDecision(Marker marker, Logger logger, Level level, String format, Object param, Throwable t)
           
 boolean isStarted()
           
 void removeListener(ContextListener listener)
           
 void setName(String name)
          The name of the context can be set only once.
 void setProperty(String key, String val)
          Set a property of this context.
 void shutdownAndReset()
           
 void start()
           
 void stop()
           
 
Methods inherited from class ch.qos.logback.core.ContextBase
getName, getObject, getProperty, getPropertyMap, getStatusManager, putObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_NAME

public static final String ROOT_NAME
See Also:
Constant Field Values
Constructor Detail

LoggerContext

public LoggerContext()
Method Detail

setProperty

public void setProperty(String key,
                        String val)
Description copied from interface: Context
Set a property of this context.

Specified by:
setProperty in interface Context
Overrides:
setProperty in class ContextBase

setName

public void setName(String name)
Description copied from interface: Context
The name of the context can be set only once.

Specified by:
setName in interface Context
Overrides:
setName in class ContextBase

getLogger

public final Logger getLogger(Class clazz)

getLogger

public final Logger getLogger(String name)
Specified by:
getLogger in interface ILoggerFactory

exists

public Logger exists(String name)
Check if the named logger exists in the hierarchy. If so return its reference, otherwise returns null.

Parameters:
name - the name of the logger to search for.

getLoggerList

public List<Logger> getLoggerList()

getLoggerContextRemoteView

public LoggerContextRemoteView getLoggerContextRemoteView()

shutdownAndReset

public void shutdownAndReset()

addTurboFilter

public void addTurboFilter(TurboFilter newFilter)
Description copied from interface: TurboFilterAttachable
Add a filter.

Specified by:
addTurboFilter in interface TurboFilterAttachable

clearAllTurboFilters

public void clearAllTurboFilters()
Specified by:
clearAllTurboFilters in interface TurboFilterAttachable

getTurboFilterChainDecision

public final FilterReply getTurboFilterChainDecision(Marker marker,
                                                     Logger logger,
                                                     Level level,
                                                     String format,
                                                     Object[] params,
                                                     Throwable t)
Description copied from interface: TurboFilterAttachable
Loop through the filters in the chain. As soon as a filter decides on ACCEPT or DENY, then that value is returned. If all of the filters return NEUTRAL, then NEUTRAL is returned.

Specified by:
getTurboFilterChainDecision in interface TurboFilterAttachable

getTurboFilterChainDecision

public final FilterReply getTurboFilterChainDecision(Marker marker,
                                                     Logger logger,
                                                     Level level,
                                                     String format,
                                                     Object param,
                                                     Throwable t)

getTurboFilterChainDecision

public final FilterReply getTurboFilterChainDecision(Marker marker,
                                                     Logger logger,
                                                     Level level,
                                                     String format,
                                                     Object param1,
                                                     Object param2,
                                                     Throwable t)

getFirstTurboFilter

public TurboFilter getFirstTurboFilter()
Description copied from interface: TurboFilterAttachable
Get first filter in the chain.

Specified by:
getFirstTurboFilter in interface TurboFilterAttachable

addListener

public void addListener(ContextListener listener)

removeListener

public void removeListener(ContextListener listener)

isStarted

public boolean isStarted()
Specified by:
isStarted in interface LifeCycle

start

public void start()
Specified by:
start in interface LifeCycle

stop

public void stop()
Specified by:
stop in interface LifeCycle

Logback API
Version 0.9.8

Copyright © 2005-2008 QOS.ch. All Rights Reserved.