You can refer to dynamic variables in your config file after having set 
them dynamically by your initialization code...

<appender name="A2" class="org.apache.log4j.FileAppender">
         <param name="File" value="${Barracuda.log.home}/main.log" />
         <param name="Append" value="false" />
         <layout class="org.apache.log4j.PatternLayout">
             <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - 
%m%n"/>
         </layout>
</appender>

I run log4j initialization at application startup in a servlet's init() 
method and create a system variable which is available to the entire 
JVM.  Because of this, I make it unique.  I just prepend the name of the 
application running (in this case "Barracuda") and append ".log.home" and 
then I just refer to that variable in the config file.  The naming is 
consistent enough that I can predict the variable.  The method I use is 
taking the name of the 
context.getAttribute("javax.servlet.context.tempdir") directory created for 
the application by the servlet container to do work specific to that 
app.  To be honest, I've only tried this in Tomcat, but there are others 
who use this on other systems and I haven't heard of any issues from them.

Jake

At 03:34 PM 8/30/2002 +0200, you wrote:
>Thanks, but I didn't anything about this possibility in the documentation.
>Could anyone please tell how it can be configured ?
>
>Thanks in advance.
>
>At 13:54 29/08/2002 -0500, you wrote:
>
>>Hello:
>>
>>The configuration class can read a system property and substitute it.  You
>>can build a unique log name for each instance of the application, assign it
>>to a system property, and use that value for the log file name.
>>
>>Regards
>>Bill Blalock
>>
>>
>>
>>                       Patrice Thiebaud
>>                       <patrice.thiebaud        To: 
>> [EMAIL PROTECTED]
>>                       @bea.com>                cc:
> >
>>                                                Subject:  Deployment of 
>> an application on multiple instances running on  the same
>>                       08/29/2002 12:24          machine
> >
>>                       PM
> >
>>                       Please respond to
>>                       "Log4J Users
>>                       List"
> >
>>
>>
>>
>>
>>
>>
>>Hi,
>>
>>Sorry if my question has already been answered.
>>
>>I need to deploy an application on multiple instances of WebLogic Server
>>running on the same machine, with the same log4j configuration file.
>>I would like to have a specific log file used for each WLS instance.
>>
>>How can it be done ?
>>
>>Thanks in advance.
>>
>>--------------------------------------------------------------
>>Patrice Thiebaud - Presales Senior Consultant
>>BEA Systems - France
>>Tour Manhattan
>>6 place de l'Iris
>>92095 PARIS La Défense Cédex
>>Tel: 33 1 41 45 70 27 Mobile: 06 08 05 95 95
>>--------------------------------------------------------------
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>
>>
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>--------------------------------------------------------------
>Patrice Thiebaud - Presales Senior Consultant
>BEA Systems - France
>Tour Manhattan
>6 place de l'Iris
>92095 PARIS La Défense Cédex
>Tel: 33 1 41 45 70 27 Mobile: 06 08 05 95 95
>--------------------------------------------------------------
>
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to