logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "DONNIE HALE" <DH...@longaberger.com>
Subject Re: Best pratice for using Log4j, EJB, Struts, and WebLogic 6.1 together
Date Tue, 05 Feb 2002 19:27:35 GMT
We have pretty much that exact environment, though we are keeping separate log files for the
web app and the EJB app.

We put our log4j config file (which specifies both appenders and category hierarchies for
us) in an "etc" directory within the .ear file. We put log4j.jar in a "lib" directory within
the .ear file. To get those things in the classpath, we specify a "Class-Path:" attribute
in our EJB .jar file's manifest:

	Class-Path: lib/log4j.jar etc/

WebLogic's classloader setup for an .ear-file deployment ensures that the log4j stuff is in
the classpath for both the EJBs and the web app. See:


As far as threading, singletons, etc., we've encountered no problems in our app. We have a
couple of classes to which we provide singleton access in the EJB container. We don't use
any non-final statics for obvious reasons. We also have a thread-local class which we use
to provide central access to a few thread-local items.

Hope that helps,


>>> eric.ma@db.com 02/05/02 01:27PM >>>
Environment: WebLogic 6.1 SP1, Struts 1.0.1, and Log4j 1.1.3.  Application is deployed as
a single .ear file in a single WebLogic instance.  log4j.jar is in the EJB classloader's classpath,
not the WebLogic classpath nor the web app's classloader classpath.

Scenario:  I want to be able to use Log4j in JSP custom tag handlers, servlets (Struts action
classes to be exact) and EJB's.

What I have done so far:  used a startup servlet to do Log4j configuration for servlets logging.
 The config file is under the web app's WEB/INF directory.  Separately, I used a factory class
with static methods to configure Log4j for EJB logging, and for this I have to use a replicate
of the configuration file but outside the .ear file.  I use a RFAppender for logging output.

What I want to achieve: configure Log4j once for the WebLogic instance, not for EJB's and
servlets separately, and I want to put the configuration file in the .ear file, not outside

Other general questions: do you see any major problems with regard to threading, singleton,
and static classes in a EJB container environment?

Any suggestion is greatly welcome.

Eric Ma


This e-mail may contain confidential and/or privileged information. If you are not the intended
recipient (or have received this e-mail in error) please notify the sender immediately and
destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message