}
if (loggerContextName != null) {
System.out.println("About to detach context named " + loggerContextName);
ContextSelector selector = ContextSelectorStaticBinder.getSingleton().getContextSelector();
if(selector == null) {
System.out.println("Selector is null, cannot detach context. Skipping.");
return;
}
LoggerContext context = selector.getLoggerContext(loggerContextName);
if (context != null) {
Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
logger.warn("Stopping logger context " + loggerContextName);
selector.detachLoggerContext(loggerContextName);
// when the web-app is destroyed, its logger context should be stopped
context.stop();
} else {
System.out.println("No context named " + loggerContextName + " was found.");
}