You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by DONNIE HALE <DH...@longaberger.com> on 2002/02/07 19:11:33 UTC

Re: Best practice for using Log4j, EJB, Struts,and WebLogic6.1together

First, I'd highly recommend against log4j.properties existing in the system classpath that WebLogic runs under. The only thing I've found that, for a typical application, would go in WebLogic's system classpath is JDBC drivers. Everything else should go in the .ear file.

Second, our use of a "lib" directory within the .ear flie is just a convention we chose, as is the use of an "etc" directory in the .ear file for property files. We use the EJB manifest's Class-Path attribute to refer to those directories at the .ear file level. My earlier message in this thread included an example Class-Path attribute for our .ear file format.

Donnie


>>> manikandan.balasubramanian@wipro.com 02/07/02 01:12AM >>>
Hi,

    We are also using the same architecture.But I have the following questions

1) What if log4j.properties exists in the classpath ?Will log4j use the file inside the EAR or the one in the classpath.How to resolve this ?
2)Our Directory structure is

    src
       |
     EJB-MODULES
     META-INF
            |
            application.xml
    WEB-MODULES

Now where exactly should I place log4j.jar.I could not understand this from J2EE blueprints or from your reply.Could you just elaborate on this "lib" folder in EAR.I have been struggling with this for quite some time now.

TIA,
Mani



DONNIE HALE wrote:

> We don't do any programmatic startup stuff. It's all in our log4j.properties file.
>
> We do use NDCs. So we have a servlet filter which sets the NDC to a value prefixed with "JSP" when the app is in the "web app space", and a dynamic proxy which sets the NDC to a value prefixed with "EJB" when the app is in the EJB space.
>
> But as far as configuration goes, it's strictly in the .properties file.
>
> Hope that helps,
>
> Donnie
>
> >>> eric.ma@comcast.net 02/05/02 08:18PM >>>
> Thanks Donnie and Ceki.  One more question - how do you set up log4j?
> Do you use a WebLogic startup class (will tie you to an app server
> vendor)? A stateless session bean that is loaded in the free pool when
> the server starts up? Or other mechanism?
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Best practice for using Log4j, EJB, Struts,and WebLogic6.1together

Posted by Bobby Nations <bw...@fedex.com>.
Donnie,

I'm in a situation where I really need to be able to modify the 
log4j.properties file after the application is deployed, which means 
that the file must be outside of the .ear file.  We're using the 
conifgureAndWatch() call to set this up and naming it something unique 
such as <app-name>-log4j.properties.  Then, it goes into the classpath 
for the app server (WebLogic 6.1).

Using this approach, when we run into problems after the application is 
deployed, we're able to modify the category in the properties file to 
set it to DEBUG, execute (or have the users execute) the steps that 
cause the problem, and get a nice output for offline perusal.  Of course 
we then set it back to WARN or ERROR as before.

Is there a better way to allow for run time configurations to take 
effect than this approach?  

Bobby


DONNIE HALE wrote:

>First, I'd highly recommend against log4j.properties existing in the system classpath that WebLogic runs under. The only thing I've found that, for a typical application, would go in WebLogic's system classpath is JDBC drivers. Everything else should go in the .ear file.
>
>Second, our use of a "lib" directory within the .ear flie is just a convention we chose, as is the use of an "etc" directory in the .ear file for property files. We use the EJB manifest's Class-Path attribute to refer to those directories at the .ear file level. My earlier message in this thread included an example Class-Path attribute for our .ear file format.
>
>Donnie
>
>
>>>>manikandan.balasubramanian@wipro.com 02/07/02 01:12AM >>>
>>>>
>Hi,
>
>    We are also using the same architecture.But I have the following questions
>
>1) What if log4j.properties exists in the classpath ?Will log4j use the file inside the EAR or the one in the classpath.How to resolve this ?
>2)Our Directory structure is
>
>    src
>       |
>     EJB-MODULES
>     META-INF
>            |
>            application.xml
>    WEB-MODULES
>
>Now where exactly should I place log4j.jar.I could not understand this from J2EE blueprints or from your reply.Could you just elaborate on this "lib" folder in EAR.I have been struggling with this for quite some time now.
>
>TIA,
>Mani
>
>
>
>DONNIE HALE wrote:
>
>>We don't do any programmatic startup stuff. It's all in our log4j.properties file.
>>
>>We do use NDCs. So we have a servlet filter which sets the NDC to a value prefixed with "JSP" when the app is in the "web app space", and a dynamic proxy which sets the NDC to a value prefixed with "EJB" when the app is in the EJB space.
>>
>>But as far as configuration goes, it's strictly in the .properties file.
>>
>>Hope that helps,
>>
>>Donnie
>>
>>>>>eric.ma@comcast.net 02/05/02 08:18PM >>>
>>>>>
>>Thanks Donnie and Ceki.  One more question - how do you set up log4j?
>>Do you use a WebLogic startup class (will tie you to an app server
>>vendor)? A stateless session bean that is loaded in the free pool when
>>the server starts up? Or other mechanism?
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>

-- 
Sr. Programmer / Analyst
FedEx Services
20 FedEx Parkway
Collierville, TN  38017
(901) 263-6517