Package ch.qos.logback.classic.selector
Class ContextJNDISelector
java.lang.Object
ch.qos.logback.classic.selector.ContextJNDISelector
- All Implemented Interfaces:
ContextSelector
A class that allows the LoggerFactory to access an environment-based
LoggerContext.
To add in catalina.sh
JAVA_OPTS="$JAVA_OPTS "-Dlogback.ContextSelector=JNDI""
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final LoggerContextprivate final Map<String, LoggerContext> private static final ThreadLocal<LoggerContext> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidconfigureLoggerContextByURL(LoggerContext context, URL url) private StringconventionalConfigFileName(String contextName) detachLoggerContext(String loggerContextName) private URLfindConfigFileURL(Context ctx, LoggerContext loggerContext) intgetCount()Returns the number of managed contexts Used for testing purposesgetLoggerContext(String name) voidvoidsetLocalContext(LoggerContext context) These methods are used by the LoggerContextFilter.private URLurlByResourceName(StatusManager sm, String resourceName)
-
Field Details
-
synchronizedContextMap
-
defaultContext
-
threadLocal
-
-
Constructor Details
-
ContextJNDISelector
-
-
Method Details
-
getDefaultLoggerContext
- Specified by:
getDefaultLoggerContextin interfaceContextSelector
-
detachLoggerContext
- Specified by:
detachLoggerContextin interfaceContextSelector
-
getLoggerContext
- Specified by:
getLoggerContextin interfaceContextSelector
-
conventionalConfigFileName
-
findConfigFileURL
-
urlByResourceName
-
configureLoggerContextByURL
-
getContextNames
- Specified by:
getContextNamesin interfaceContextSelector
-
getLoggerContext
- Specified by:
getLoggerContextin interfaceContextSelector
-
getCount
public int getCount()Returns the number of managed contexts Used for testing purposes- Returns:
- the number of managed contexts
-
setLocalContext
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-
-
removeLocalContext
public void removeLocalContext()
-