
http://bugzilla.slf4j.org/show_bug.cgi?id=291 Summary: Unusable with Logback-ContextSelectors. Product: SLF4J Version: 1.7.x Platform: PC OS/Version: Windows XP Status: NEW Severity: major Priority: P1 Component: log4j-over-slf4j AssignedTo: slf4j-dev@qos.ch ReportedBy: thomas.moeller@continentale.de Log4j-Loggers are cached in static fields. See org.apache.log4j.Log4jLoggerFactory: public static synchronized Logger getLogger(String name) { if (log4jLoggers.containsKey(name)) { return (org.apache.log4j.Logger) log4jLoggers.get(name); } else { Logger log4jLogger = new Logger(name); log4jLoggers.put(name, log4jLogger); return log4jLogger; } } A Log4j-Logger caches a reference to a Slf4j-Logger. See org.apache.log4j.Category: Category(String name) { this.name = name; slf4jLogger = LoggerFactory.getLogger(name); if (slf4jLogger instanceof LocationAwareLogger) { locationAwareLogger = (LocationAwareLogger) slf4jLogger; } } The problem is that the result of LoggerFactory.getLogger(name) is not cacheable because it could depend on Logback-ContextSelectors. One example: the JNDI-ContextSelector switches between different JNDI-Contexts. If the log4j-over-slf4j bridge jar is installed in a shared classloader the first request to getLogger() would tie the logger to the respective JNDI-Context. And it is not a solution to move the bridge jar to each web application because the context selector could switch e. g. between users. -- Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug.