org.red5.logging

## Class LoggingContextSelector

- java.lang.Object
- - org.red5.logging.LoggingContextSelector

All Implemented Interfaces:
  ch.qos.logback.classic.selector.ContextSelector

    public class LoggingContextSelector
    extends Object
    implements ch.qos.logback.classic.selector.ContextSelector

A class that allows the LoggerFactory to access an web context based LoggerContext. Add this java option -Dlogback.ContextSelector=org.red5.logging.LoggingContextSelector

Author:
  Paul Gregoire (mondain@gmail.com)

### Constructor Summary

Constructors
Constructor and Description
`LoggingContextSelector(ch.qos.logback.classic.LoggerContext context)`

### Method Summary

Methods
`void` `attachLoggerContext(String contextName, ch.qos.logback.classic.LoggerContext loggerContext)`
`ch.qos.logback.classic.LoggerContext` `detachLoggerContext(String loggerContextName)`
`List<String>` `getContextNames()`
`int` `getCount()` Returns the number of managed contexts Used for testing purposes
`ch.qos.logback.classic.LoggerContext` `getDefaultLoggerContext()`
`ch.qos.logback.classic.LoggerContext` `getLoggerContext()`
`ch.qos.logback.classic.LoggerContext` `getLoggerContext(String name)`
`void` `removeLocalContext()`
`void` `setContextConfigFile(String contextConfigFile)`
`void` `setContextName(String contextName)`
`void` `setLocalContext(ch.qos.logback.classic.LoggerContext context)` These methods are used by the LoggerContextFilter.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### LoggingContextSelector

    public LoggingContextSelector(ch.qos.logback.classic.LoggerContext context)

### Method Detail

#### getLoggerContext

    public ch.qos.logback.classic.LoggerContext getLoggerContext()

Specified by:
  `getLoggerContext` in interface `ch.qos.logback.classic.selector.ContextSelector`

#### getLoggerContext

    public ch.qos.logback.classic.LoggerContext getLoggerContext(String name)

Specified by:
  `getLoggerContext` in interface `ch.qos.logback.classic.selector.ContextSelector`

#### getDefaultLoggerContext

    public ch.qos.logback.classic.LoggerContext getDefaultLoggerContext()

Specified by:
  `getDefaultLoggerContext` in interface `ch.qos.logback.classic.selector.ContextSelector`

#### attachLoggerContext

    public void attachLoggerContext(String contextName,
                           ch.qos.logback.classic.LoggerContext loggerContext)

#### detachLoggerContext

    public ch.qos.logback.classic.LoggerContext detachLoggerContext(String loggerContextName)

Specified by:
  `detachLoggerContext` in interface `ch.qos.logback.classic.selector.ContextSelector`

#### getContextNames

    public List<String> getContextNames()

Specified by:
  `getContextNames` in interface `ch.qos.logback.classic.selector.ContextSelector`

#### setContextName

    public void setContextName(String contextName)

#### setContextConfigFile

    public void setContextConfigFile(String contextConfigFile)

#### getCount

    public int getCount()

Returns the number of managed contexts Used for testing purposes

Returns:
  the number of managed contexts

#### setLocalContext

    public void setLocalContext(ch.qos.logback.classic.LoggerContext context)

These methods are used by the LoggerContextFilter. They provide a way to tell the selector which context to use, thus saving the cost of a JNDI call at each new request.

Parameters:
  `context` - logging context

#### removeLocalContext

    public void removeLocalContext()