public LoggerContext getLoggerContext() {
String contextName = null;
Context ctx = null;
// First check if ThreadLocal has been set already
LoggerContext lc = threadLocal.get();
if (lc != null) {
return lc;
}
try {
// We first try to find the name of our
// environment's LoggerContext
ctx = JNDIUtil.getInitialContext();
contextName = (String) JNDIUtil.lookup(ctx, JNDI_CONTEXT_NAME);
} catch (NamingException ne) {
// We can't log here
}
if (contextName == null) {
// We return the default context
return defaultContext;
} else {
// Let's see if we already know such a context
LoggerContext loggerContext = contextMap.get(contextName);
if (loggerContext == null) {
// We have to create a new LoggerContext
loggerContext = new LoggerContext();
loggerContext.setName(contextName);
contextMap.put(contextName, loggerContext);
// Do we have a dedicated configuration file?
String configFilePath = JNDIUtil.lookup(ctx,
JNDI_CONFIGURATION_RESOURCE);