Hi Steve, Thanks for the example. For my project, I'd like to do the following,
############################################################# # Define the root category ############################################################# log4j.rootCategory=DEBUG, STDOUT log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout log4j.appender.STDOUT.layout.ConversionPattern=............. ############################################################# # Define logger-specific appenders ############################################################# log4j.cat1=DEBUG,FILE1 log4j.cat1=ERROR,FILE2 log4j.cat1=FATAL,MAIL3 log4j.additivity.cat1=false log4j.cat2=DEBUG,FILE4 log4j.cat2=ERROR,FILE5 log4j.cat2=FATAL,MAIL6 log4j.additivity.cat2=false #define appenders for each category ############################################################# I find that I'm unable to log anything unless I specify all appenders as part of the rootCategory. i.e log4j.rootCategory=DEBUG, STDOUT, FILE1, FILE2, MAIL3, FILE4, FILE5, MAIL6 Once I include all the appenders in the rootCategory, when I log for cat2, it writes to the files for cat1 and cat2. I'm defining a category as, Category cat = Category.getInstance("cat1"); before I start logging. I would like to be able to use the categories as shown in your example (without having to specify the appenders for the categories in the root as well). What changes will I need to make for this? Thanks, Ranjini. > -----Original Message----- > From: Steve Ebersole [SMTP:[EMAIL PROTECTED]] > Sent: Friday, February 22, 2002 7:55 PM > To: Log4J Users List > Subject: Re: Working with two or more categories > > Here is an example (I'll use the new "Logger" syntax): > > ############################################################# > # Define the root logger > ############################################################# > log4j.rootLogger=DEBUG, STDOUT > log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender > log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout > log4j.appender.STDOUT.layout.ConversionPattern=............. > > ############################################################# > # Define logger-specific appenders > ############################################################# > log4j.cat1=INFO, FILE1 > log4j.additivity.cat1=false > > log4j.cat2=WARN, FILE2 > log4j.additivity.cat2=false > > log4j.appender.FILE1=org.apache.log4j.DailyRollingFileAppender > log4j.appender.FILE1.file=/the/file/for/category1 > > log4j.appender.FILE2=org.apache.log4j.DailyRollingFileAppender > log4j.appender.FILE2.file=/the/file/for/category2 > > > > > ----- Original Message ----- > From: "Nair, Ranjini" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, February 22, 2002 2:47 PM > Subject: Working with two or more categories > > > > Hi, > > Is it possible to have two or more categories in a properties file and > get > > the log output to go to different log files based on category? How > should > > the categories be defined to do this? > > > > Thanks, > > Ranjini. > > > > > > -- > > 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]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>