Return-Path: Delivered-To: apmail-jakarta-log4j-dev-archive@www.apache.org Received: (qmail 94746 invoked from network); 17 Sep 2003 19:02:48 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 17 Sep 2003 19:02:48 -0000 Received: (qmail 30955 invoked by uid 500); 17 Sep 2003 19:02:36 -0000 Delivered-To: apmail-jakarta-log4j-dev-archive@jakarta.apache.org Received: (qmail 30933 invoked by uid 500); 17 Sep 2003 19:02:36 -0000 Mailing-List: contact log4j-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Log4J Developers List" Reply-To: "Log4J Developers List" Delivered-To: mailing list log4j-dev@jakarta.apache.org Received: (qmail 30920 invoked from network); 17 Sep 2003 19:02:36 -0000 Received: from unknown (HELO exchange.sun.com) (192.18.33.10) by daedalus.apache.org with SMTP; 17 Sep 2003 19:02:36 -0000 Received: (qmail 16840 invoked by uid 50); 17 Sep 2003 19:05:35 -0000 Date: 17 Sep 2003 19:05:35 -0000 Message-ID: <20030917190535.16839.qmail@nagoya.betaversion.org> From: bugzilla@apache.org To: log4j-dev@jakarta.apache.org Cc: Subject: DO NOT REPLY [Bug 23224] New: - cannot use NTEventLogAppender in multiple classloaders (webapps) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23224 cannot use NTEventLogAppender in multiple classloaders (webapps) Summary: cannot use NTEventLogAppender in multiple classloaders (webapps) Product: Log4j Version: 1.2 Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: Other Component: Appender AssignedTo: log4j-dev@jakarta.apache.org ReportedBy: jmm@sublogic.com single Tomcat running, multiple webapps, each of which has their own log4j and wants to use NTEventLogAppender. The problem is that the class loads its native library without try/catch'ing, so when any classloader besides the first attempts to load the library (as part of its classloader loading the NTEventLogAppender class file itself), there's an exception and the logging fails. so, the end of NTEventLogAppender.java is now: static { System.loadLibrary("NTEventLogAppender"); } That would be better with a try/catch of the loadLibrary so then the other webapps could load the class and use it. Note that the system classloader is where the library is actually loaded, so the other classloaders should have access to it just fine. static { try { System.loadLibrary("NTEventLogAppender"); } catch (Throwable t) {} } (would prob. wanna replace Throwable with whatever the specific type of exception is that's thrown for the second-and-later classloaders, I don't have my logs around to check any more). Alternative work-around is to use something System-wide (outside of the individual classloaders) like a System property: static { if(System.getProperty("NTEventLogAppender.loaded") == null) { System.loadLibrary("NTEventLogAppender"); System.setProperty("NTEventLogAppender.loaded", "true"); } } --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: log4j-dev-help@jakarta.apache.org