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 = synchronizedContextMap.get(contextName);
if (loggerContext == null) {
// We have to create a new LoggerContext
loggerContext = new LoggerContext();
loggerContext.setName(contextName);
synchronizedContextMap.put(contextName, loggerContext);
URL url = findConfigFileURL(ctx, loggerContext);
if (url != null) {
configureLoggerContextByURL(loggerContext, url);
} else {