At 09:56 27.07.2001 +0300, you wrote:
>Hi all ,
>
>Question 1 = 
>i am using tomcat with this option 
>        -Dlog4j.configuration=file:/usr/local/test/log4j.properties
>
>only one configuration file for all web applications
>
>and my configuration files's content =  
>
>****************************************************************************
>******************
>log4j.category.deneme=INFO, logx
>log4j.additivity.deneme=false
>log4j.appender.logx=org.apache.log4j.RollingFileAppender 
>log4j.appender.logx.File=/tmp/test.log 
>log4j.appender.logx.layout.ConversionPattern=%-25d %p %-40.40c{1} %3x - %m%n
>
>log4j.appender.logx.layout=org.apache.log4j.PatternLayout 
>log4j.appender.logx.MaxFileSize=10MB 
>log4j.appender.logx.MaxBackupIndex=1 
>
>log4j.category.deneme2=DEBUG, logy
>log4j.additivity.deneme2=false
>log4j.appender.logy=org.apache.log4j.RollingFileAppender 
>log4j.appender.logy.File=/tmp/bireysel.log 
>log4j.appender.logy.layout.ConversionPattern=%-25d %p %-40.40c{1} %3x - %m%n
>
>log4j.appender.logy.layout=org.apache.log4j.PatternLayout 
>log4j.appender.logy.MaxFileSize=10MB 
>log4j.appender.logy.MaxBackupIndex=1 ,
>****************************************************************************
>******************
>
>there are two category objects  , and each my tomcat's contexts using only
>one category , 
>lets say , i have got two contexts , test1 and test and 
>java beans under test1 context uses deneme category
>java beans under test2 context uses deneme2 category , 
>is it dengerous because in the log4j document( page 12 ) it says that =
>"Thus, the same configuration file will be used for all web-applications --
>in other words, disaster waiting to happen"

Different web applications load the log4j classes from different classloaders. Thus, 
appender synchronization will not work. In particular, your rolling appender output 
will be messed up because multiple rolling appenders will write to the same file 
without any synchronization whatsoever. They might even roll the same file in a 
totally uncontrolled fashion.

So yes. The practice of having one config file for all webapps is unsafe.  

If you want to have one config file for all your webapps, then you parameterize the 
name of the output file. As in

log4j.appender.logx=org.apache.log4j.RollingFileAppender 
log4j.appender.logx.File=${testFile}

where the system property "testFile" is set differently for each of your webapps.


>Question 2 = 
>In the test1 context , all my java beans under this context , logs the
>error's using the same category object 
>
>is it dangerous ? 

I don't understand the question.


--
Ceki Gülcü - http://qos.ch


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

Reply via email to