DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=35754>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=35754 Summary: Log4jEntityResolver does not work well inside app server Product: Log4j Version: 1.2beta Platform: Other OS/Version: other Status: NEW Severity: major Priority: P2 Component: Configurator AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] Hi, I'm trying to use log4j 1.2.11 initialized via DOMConfigurator inside Weblogic app server 8.1. For this, I read the log4j.xml from the init() method of a servlet inside my war. The log4j.xml is not included inside the war file, but outside, to be able to change it while running, and the XMLWatchdog should take care of re-reading it. The config is read OK the first time (on deploy), and I'm mostly sure because it is done in the deploy thread instead of the XMLWatchdog thread. After that, if you try to change the file the XMLWatchdog tries to read it again and throws a MalformedUrlException because it is not able to find the log4j.dtd. Debugging inside weblogic I have found that the ClassLoader that is being used by Log4jEntityResolver to load the resource is not correct IMHO: Correct ClassLoader (the one that is able to find log4j.xml): Thread.currentThread().getContextClassLoader().toString()= [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: [EMAIL PROTECTED], parent: [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: _appsdir_myapp_ear@, parent: [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: ApplicationClassLoader@, parent: [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: null, parent: [EMAIL PROTECTED])))) Incorrect ClassLoader (the one that log4j ends up using): clazz.getClassLoader().toString()= [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: _appsdir_myapp_ear@, parent: [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: ApplicationClassLoader@, parent: [EMAIL PROTECTED]( finder: [EMAIL PROTECTED], annotation: null, parent: [EMAIL PROTECTED]))) A fix would be to substitute this: Class clazz = getClass(); InputStream in = clazz.getResourceAsStream("/org/apache/log4j/xml/log4j.dtd"); With this: InputStream in = Thread.currentThread().getResourceAsStream("org/apache/log4j/xml/log4j.dtd"); -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
