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

public Class ContextJNDISelector

extends Object
implements ContextSelector
Class Inheritance
All Implemented Interfaces
ch.qos.logback.classic.selector.ContextSelector
Static Imports
ch.qos.logback.classic.ClassicConstants.JNDI_CONFIGURATION_RESOURCE, .ClassicConstants.JNDI_CONTEXT_NAME

A class that allows the LoggerFactory to access an environment-based LoggerContext.

To add in catalina.sh

JAVA_OPTS="$JAVA_OPTS "-Dlogback.ContextSelector=JNDI""

Authors
Ceki Gülcü, Sébastien Pennec

Field Summary

Modifier and TypeField and Description
private final LoggerContext
private final Map<String, LoggerContext>
private static final ThreadLocal<LoggerContext>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private String
public LoggerContext
private URL
findConfigFileURL(javax.naming.Context ctx, LoggerContext loggerContext)

public List<String>
public int

Returns:

the number of managed contexts
getCount
()

Returns the number of managed contexts Used for testing purposes

public LoggerContext
public LoggerContext
public LoggerContext
public void
public void
setLocalContext(LoggerContext context)

These methods are used by the LoggerContextFilter.

private URL
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultContextback to summary
private final LoggerContext defaultContext
synchronizedContextMapback to summary
private final Map<String, LoggerContext> synchronizedContextMap
threadLocalback to summary
private static final ThreadLocal<LoggerContext> threadLocal

Constructor Detail

ContextJNDISelectorback to summary
public ContextJNDISelector(LoggerContext context)

Method Detail

configureLoggerContextByURLback to summary
private void configureLoggerContextByURL(LoggerContext context, URL url)
conventionalConfigFileNameback to summary
private String conventionalConfigFileName(String contextName)
detachLoggerContextback to summary
public LoggerContext detachLoggerContext(String loggerContextName)

Implements ch.qos.logback.classic.selector.ContextSelector.detachLoggerContext.

findConfigFileURLback to summary
private URL findConfigFileURL(javax.naming.Context ctx, LoggerContext loggerContext)
getContextNamesback to summary
public List<String> getContextNames()

Implements ch.qos.logback.classic.selector.ContextSelector.getContextNames.

getCountback to summary
public int getCount()

Returns the number of managed contexts Used for testing purposes

Returns:int

the number of managed contexts

getDefaultLoggerContextback to summary
public LoggerContext getDefaultLoggerContext()

Implements ch.qos.logback.classic.selector.ContextSelector.getDefaultLoggerContext.

getLoggerContextback to summary
public LoggerContext getLoggerContext()

Implements ch.qos.logback.classic.selector.ContextSelector.getLoggerContext.

getLoggerContextback to summary
public LoggerContext getLoggerContext(String name)

Implements ch.qos.logback.classic.selector.ContextSelector.getLoggerContext.

removeLocalContextback to summary
public void removeLocalContext()
setLocalContextback to summary
public void setLocalContext(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.

urlByResourceNameback to summary
private URL urlByResourceName(StatusManager sm, String resourceName)