logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel's List Box <marcel.l...@gmail.com>
Subject ClassCast when initializing custom Log4j in WebSphere EJB container.
Date Mon, 06 Dec 2004 11:54:11 GMT
Hello,

I've written my own XLogger extends Logger and I've been using it
without problems in stand-alone apps and Web containers. In my
log4j.properties I specify that my Factory should be used so 3rd party
jars which use standard Logger also use my XLogger:

log4j.loggerFactory=com.sdmc.XLoggerFactory
log4j.categoryFactory=com.sdmc.XLoggerFactory

Also, to debug commons stuff, i have commons-logging.properties stating:

org.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory

Now... i have a WebSphere 4.0 EAR with 1 web and 1 ejb module. When an
ejb using XLogger is created i get a ClassCastException on XLogger.
Probably a Logger is already instantiated before my log4j.properties
is being read so the Logger singleton is a Logger, not an XLogger

I tried putting log4j.properties in my ejb jar, i tried putting it in
the root of the ear and adding it to the Manifest.mf. Now i may end up
writing my own Configurator  but **who is going to call it**? When
using log4j in a web container you can have a Log4jInitServlet
(start-up=1) to initialize log4j... but when in a ejb container...
how is this Log4jInitBean going to be the first thing to be created?

I have run out of options, just bought Ceki Gulcu's "Complete Log4j
manual" but i cannot find an answer. On page 92 it says what not to do
in case of WebSphere.. but doesn't say what to do...

Think part of the problem might be in the fact that WebSphere uses
commons-logging under the hood?

Hope somebody can help me out!

Thanks,
- Marcel Heemskerk

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message