Kaneda,

1) Yes, you have the right order, and understanding.

2 & 3) I think your settings for the categories are incorrect.  I refer you
to the "short introduction" found at
http://jakarta.apache.org/log4j/docs/manual.html.

Instead of:

log4j.appender.stdout.category.com.foo=INFO

you should have:

log4j.category.com.foo=INFO

Any log4j output from the category named "com.foo" of priority INFO or
higher will be output.  With your settings, the output will be caught by the
appenders defined for the rootCategory, stdout, R1, R2.  If you wanted the
output of a category to go to a specific appender, you could remove one from
the rootCategory, say R1, and "attach" it to the category you want as:

log4j.category.com.foo=INFO, R1

I would also recommend looking at and using an xml configuration file.
There should be better documentation on the xml settings, but once you
figure out the DTD the configuration definition make more sense (in my
opinion).

Hope it helps,
-Mark



-----Original Message-----
From: Kaneda K [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 6:42 AM
To: [EMAIL PROTECTED]
Subject: How to configure LOG4J


   Hello,
  As you can see I am new and I can not correctly configure Log4j in order 
to publish different LEVEL out put so I'll ask few question :

1. just to be sure :
    DEBUG < INFO < WARN < ERROR < FATAL
    Which means that If I set my appender to DEBUG, I'll retrieve all the
Log,
    and I set to   ERROR I'll only gonna retrieve ERROR and FATAL
    ?

2. This is where I have a problem I try to have 2 differentes output :
one for the log from com.foo.MyApp2 and another for the log from
com.foo.Bar.

I obtain 2 file but they have the same value.

3. I Also try to have different Log level for those 2

this is my properties file : (the classes com.foo.MyApp2 and com.foo.Bar 
are from the manual http://jakarta.apache.org/log4j/docs/manual.html)

# Log4 File
log4j.rootCategory=WARN, stdout, R1, R2
                    ^ I set the default level here
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
log4j.appender.stdout.category.com.foo=INFO
# getsion de R qui est pour les fichiers.
log4j.appender.R1=org.apache.log4j.RollingFileAppender
log4j.appender.R1.File=E:\\java\\jakarta-tomcat-3.3-b1\\webapps\\log4j\\WEB-
INF\\log\\example1.log
log4j.appender.R1.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R1.MaxBackupIndex=1
log4j.appender.R1.layout=org.apache.log4j.PatternLayout
log4j.appender.R1.layout.ConversionPattern=[%p] %t (%c) - %m  - %d{dd MMM 
yyyy HH:mm:ss,SSS} %n
log4j.appender.R1.category.com.foo=INFO
                                    ^ this is where I set the level for file
1

log4j.appender.R2=org.apache.log4j.RollingFileAppender
log4j.appender.R2.File=E:\\java\\jakarta-tomcat-3.3-b1\\webapps\\log4j\\WEB-
INF\\log\\example2.log
log4j.appender.R2.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R2.MaxBackupIndex=1
log4j.appender.R2.layout=org.apache.log4j.PatternLayout
log4j.appender.R2.layout.ConversionPattern=[%p] %t (%c) - %m  - %d{dd MMM 
yyyy HH:mm:ss,SSS} %n
log4j.appender.R2.category.com.foo.bar=ERROR
                                    ^ this is where I set the level for file
2


---------------------------------------------------------------------
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]

Reply via email to