No problem to load log4j xml or properties, file system is invisible in J2EE container
since J2EE is distributed and portable system, instead, use classloader and make sure
log4j xml/properties in the classpath.
But I encountered another problem, see below (posted on OTN but nobody answer yet):
Hi,
Wonder who has log4j.xml experience in EJB environment?
I tried on Oracle 10gAS on Windows (the iAS version actually is still 9.0.4.2), my
log4j initilization code looks like:
InputStream inStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream(sLogFileName);
new DOMConfigurator().doConfigure(inStream, LogManager.getLoggerRepository());
There is no problem to find the log4j.xml however the application server complains the
log4j.dtd:
--------
04/10/08 18:48:18 Start process
--------
04/10/08 18:48:33 Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)
initialized
04/10/08 18:49:09 log4j:ERROR Parsing error on line 0 and column 0
04/10/08 18:49:09 log4j:ERROR File "dummy://log4j.dtd" not found.
04/10/08 18:49:09 log4j:ERROR Could not parse input source [EMAIL PROTECTED]
04/10/08 18:49:09 org.xml.sax.SAXException: Stopping after fatal error: File
"dummy://log4j.dtd" not found.
04/10/08 18:49:09 at
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1245)
04/10/08 18:49:09 at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromDocument(DefaultEntityHandler.java:501)
04/10/08 18:49:09 at
org.apache.xerces.framework.XMLParser.parseSomeSetup(XMLParser.java:314)
04/10/08 18:49:09 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1097)
04/10/08 18:49:09 at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:195)
04/10/08 18:49:09 at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:665)
04/10/08 18:49:09 at
org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:616)
I check DOMConfiguration.java, it contains:
docBuilder.setErrorHandler(new SAXErrorHandler());
docBuilder.setEntityResolver(new Log4jEntityResolver());
// we change the system ID to a valid URI so that Crimson won't
// complain. Indeed, "log4j.dtd" alone is not a valid URI which
// causes Crimson to barf. The Log4jEntityResolver only cares
// about the "log4j.dtd" ending.
inputSource.setSystemId("dummy://log4j.dtd");
Document doc = docBuilder.parse(inputSource);
parse(doc.getDocumentElement());
Anybody has an idea and help me? Thanks in advance.
Francesco Russo <[EMAIL PROTECTED]> wrote:
Hi guys,
has anyone ever tried to work with log4j from Session Beans deployed in
Oracle AppServ?
I'm having troubles in making log4j find its configuration file.
I've already set the log4j.configuration system property using something
like:
-Dlog4j.configuration=/opt/oracle/product/10g/j2ee/home/log4j/log4j.xml
but with no result.
Any suggestion?
Thanks in advance,
--
______________________________________________________
Francesco Russo
CINECA - Interuniversitary Computing Centre
http://www.cineca.it
via Magnanelli, 6/3
40033 Casalecchio di Reno (Bologna) - ITALY
e-mail: [EMAIL PROTECTED]
Phone: +39 051 6171 775
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.