hi ,
first of all , is it possible to use one configuration file with tomcat ?
or i have to use different configuration files for every context in tomcat ?
i want to use one configuration file for different contexts , for example i
have got two contexts
1 - context1
2 - context2
here is my configuration file =
*******************************************************************
# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG , Con1 , Con2
# Con1 is set to be a File Appender
log4j.appender.Con1=org.apache.log4j.FileAppender
log4j.appender.Con1.File=/tmp/Context1.log
# Con1 uses PatternLayout.
log4j.appender.Con1.layout=org.apache.log4j.PatternLayout
log4j.appender.Con1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
# Con2 is set to be a File Appender
log4j.appender.Con2=org.apache.log4j.FileAppender
log4j.appender.Con2.File=/tmp/Context2.log
# Con2 uses PatternLayout.
log4j.appender.Con2.layout=org.apache.log4j.PatternLayout
log4j.appender.Con2.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
*********************************************************************
i bind this configuration file to tomcat like this , in the /etc/profile
file i set TOMCAT_OPTS
TOMCAT_OPTS=" -Dlog4j.configuration=/usr/local/test/log4j.properties"
Not = i am sure that log4j.properties file is there
here is my bean's code
********************************************************************
import org.apache.log4j.*;
public class Hebelek {
static Category cat = Category.getInstance("Con1"); // is it true ?
private int id ;
public void setWork(int value) {
id = value;
cat.info("In the setWork method");
}
public int getWork() {
return id ;
}
}
*****************************************************************
then when i try to reach Hebelek bean via jsp under Context1 , Log4j
gives that error =
No appenders could be found for category (Con1)
i cant understand why ? any idea ?
Thanks ..
-----Original Message-----
From: Robert Leftwich [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 20, 2001 12:08 PM
To: LOG4J Users Mailing List
Subject: RE: tomcat and log4j
At 05:14 PM 20/07/2001, [EMAIL PROTECTED] wrote:
>thanks for the answers ..
>
>if i decide to use only one log4j.properties with tomcat , where can i put
>this log4j.properties file
>and how can i use logging system in my beans ? in every bean's method i
>have to set like that
>
>
>PropertyConfigurator.configure("/usr/local/tomcat/conf/log4j.properties");
>
>???
>
>
>i have confused, because log4j documents aren't very clear especially the
>tomcat part
>so if anyone can send me simple and short example i will be glad ..
Have you read the documentation for log4j 1.1.3? In the 'Introductory
manual' there is a section titled 'Default Initialization under
Tomcat' that contains the following :
Example 4
The Windows shell command
set TOMCAT_OPTS=-Dlog4j.configuration=file:/c:/foobar.lcf
tells log4j to use the file c:\foobar.xml as the default configuration
file. The configuration file is fully specified by the URL
file:/c:/foobar.lcf. Thus, the same configuration file will be used for all
web-applications -- in other words, disaster waiting to happen.
Use at your own peril!
Robert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]