Package 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 ([email protected])
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Stringprivate static final ConcurrentMap<String,ch.qos.logback.classic.LoggerContext> private static ch.qos.logback.classic.LoggerContextstatic final Stringprivate static final Semaphoreprivate final ThreadLocal<ch.qos.logback.classic.LoggerContext> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidattachLoggerContext(String contextName, ch.qos.logback.classic.LoggerContext loggerContext) ch.qos.logback.classic.LoggerContextdetachLoggerContext(String contextName) intgetCount()Returns the number of managed contexts Used for testing purposesch.qos.logback.classic.LoggerContextch.qos.logback.classic.LoggerContextch.qos.logback.classic.LoggerContextgetLoggerContext(String contextName) ch.qos.logback.classic.LoggerContextgetLoggerContext(String contextName, URL url) voidvoidsetContextConfigFile(String contextConfigFile) voidsetLocalContext(ch.qos.logback.classic.LoggerContext context) These methods are used by the LoggerContextFilter.
-
Field Details
-
lock
-
contextMap
-
DEFAULT_CONTEXT
private static ch.qos.logback.classic.LoggerContext DEFAULT_CONTEXT -
threadLocal
-
contextConfigFile
-
KEY_APP_NAME
- See Also:
-
-
Constructor Details
-
LoggingContextSelector
public LoggingContextSelector(ch.qos.logback.classic.LoggerContext context)
-
-
Method Details
-
getLoggerContext
public ch.qos.logback.classic.LoggerContext getLoggerContext()- Specified by:
getLoggerContextin interfacech.qos.logback.classic.selector.ContextSelector
-
getLoggerContext
- Specified by:
getLoggerContextin interfacech.qos.logback.classic.selector.ContextSelector
-
getLoggerContext
-
getDefaultLoggerContext
public ch.qos.logback.classic.LoggerContext getDefaultLoggerContext()- Specified by:
getDefaultLoggerContextin interfacech.qos.logback.classic.selector.ContextSelector
-
attachLoggerContext
public void attachLoggerContext(String contextName, ch.qos.logback.classic.LoggerContext loggerContext) -
detachLoggerContext
- Specified by:
detachLoggerContextin interfacech.qos.logback.classic.selector.ContextSelector
-
getContextNames
- Specified by:
getContextNamesin interfacech.qos.logback.classic.selector.ContextSelector
-
setContextConfigFile
-
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()
-