Problem logging data from different classes to different log files
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Parimala_Ramdas
Posted On:   Wednesday, January 10, 2007 11:03 AM

Hi,

I have 2 different packages that each have log4j.properties file. The main class is in package1 and calls the classes from package2.


Now what I want is for package1 to have a different log file and in package2 there are 2 classes that I want to be logged to 2 different log files.


The setup I have is each package has a prop file with rootLogger but the package2 in addition has 2 appenders that defines 2 log file names.


The problem is that output from package1 and package2 are going to all 3 log files. Why is this happening? Is there something wrong in what I'm doing? Any help will be greatly appreciated. Thanks in advance!

Re: Problem logging data from different classes to different log files

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, January 13, 2007 12:17 AM

If you want to send a logger to a different Appender than its parent, I think you also have to add a line for that logger, saying "additivity=false". So you'll have one line saying "log4j.logger.my.package=DEBUG,MyAppender" but then you need another line saying "log4j.logger.my.package.additivity=FALSE".
About | Sitemap | Contact