if (method.getName().equals("getContextSelector")) {
//System.out.println("Logger context selector method found");
//get the context selector
StaticLoggerBinder binder = StaticLoggerBinder.getSingleton();
Method m1 = binder.getClass().getMethod("getContextSelector", (Class[]) null);
ContextSelector selector = (ContextSelector) m1.invoke(binder, (Object[]) null);
//get the context for the given context name or default if null
LoggerContext ctx = null;
if (contextName != null && contextName.length() > 0) {
ctx = selector.getLoggerContext(contextName);
}
// and if we get here, fall back to the default context
if (ctx == null) {
ctx = selector.getLoggerContext();
}
//debug
//StatusPrinter.print(ctx);
//get the logger from the context or default context
logger = ((ctx != null) ? ctx.getLogger(clazz) : selector.getDefaultLoggerContext().getLogger(clazz));
break;
}
}
} catch (Exception e) {
//no logback, use whatever logger is in-place