On Tue, 4 Jun 2002, Samip Ladhawala wrote:

> Date: Tue, 4 Jun 2002 20:10:09 -0700 (PDT)
> From: Samip Ladhawala <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Design Strategy with commons-logging
>
>
> Hi,
>
> We wish to use commons-logging in our enterprise project, where the
> frontend is powered by struts framework.
>

Sounds like a good plan.  For the record, the Commons Logging package is
documented in its JavaDocs, which are available online at:

  http://jakarta.apache.org/commons/logging/api/index.html

You can also get the download bundles (binary and source) for Commons
Logging 1.0 from:

  http://jakarta.apache.org/builds/jakarta-commons/release/commons-logging/v1.0/


> All our struts related code is in xxxWeb folder under which we have
> various packages containing classes extending from Formbeans and
> Actions. Action classes call business delegates which are under xxxJava
> folder.  xxxJava folder contains various packages which consist of
> delegator and helper classes. Delegator further interacts with a
> business controller which is a proxy to make calls to EJBController.
> EJBController further interacts with session/entity beans.
>
> We have log4j.properties currently in xxxWeb/classes/log4j.properties.
>

I don't know all the options for Log4J, but shouldn't this file be in the
"WEB-INF/classes" subdirectory of your webapps?

> Questions
>
> 1. Do I need to include commons-logging.jar in all the packages for
> compilation dependencies and in server classpath for runtime? If Yes,
> then what all dependent files I need to include along with
> commons-logging?
>

You will need commons-logging.jar in your compile classpath.  Unless you
use Log4J facilities directly in part of your code, you won't need
log4j.jar at compile time -- in fact, if you are using commons logging as
an insulation layer so that you can change your mind about logging
implementations later, you don't want to compile directly against any
particular logging implementation.

At runtime, you need commons-logging.jar plus the JAR file for Log4J or
whatever implementation you wish to use.  Commons Logging is designed so
that you can put these two JARs inside your webapp (in the /WEB-INF/lib
subdirectory), or in the shared directory for your container (such as the
"lib" directory in Tomcat 4.0.x, or "shared/lib" in Tomcat 4.1.x).

Commons Logging itself has no compile-time (of your app) dependencies, and
no runtime dependencies other than the logging implementation you chose to
use.

> 2. Do I need to have different copies of log4j.properties in different
> layers as they may run on different JVM or even different machines
> altogether?
>

The details depend very greatly on the container you are using, but in
general each JVM will need its own configuration.  Within a single JVM,
you can usually rig things so that a single logging configuration gets
shared, or individual configurations per webapp, depending on where you
put the JAR files and configuration files.

> I'll really appreciate if someone can give directions to correctly
> implement commons-logging package in an Enterprise Application.
>
> We are currently using WSAD 4.0.3 (Eclipse+ Stand alone WAS server).
> Application will be deployed on WAS4.0.

For details of Log4J specifically, you might want to ask questions on the
Log4J users list -- all of the details of *configuring* Log4J will be
identicial whether you are using using commons logging or not.  Only the
APIs used to access it are different.

>
> Thanks,
>
> Samip.
>

Craig


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to