dcsimg
Log to a different file for each class in Log4j
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Leslie_Loh
Posted On:   Wednesday, April 2, 2003 01:53 AM

Hi, I am trying to log the messages from different classes to predefined named logfiles and on daily rotation. e.g. MyClass1.class will log to MyClass1.log.2003-04-02 and MyClass2.class will log to MyClass2.log.2003-04-02 I have found in the forum and docs on how to set for daily rolling file appenders. But how do I set it to log to different file name for different class? Can I use the PropertyConfigurator.configureAndWatch("MyClass1.properties", 60000); to read from different properties files? or is there anyother way for me to set the FILE properties programatically? Thanks.    More>>

Hi, I am trying to log the messages from different classes to predefined named logfiles and on daily rotation.



e.g. MyClass1.class will log to MyClass1.log.2003-04-02
and MyClass2.class will log to MyClass2.log.2003-04-02



I have found in the forum and docs on how to set for daily rolling file appenders. But how do I set it to log to different file name for different class?



Can I use the

			
PropertyConfigurator.configureAndWatch("MyClass1.properties", 60000);



to read from different properties files?



or is there anyother way for me to set the FILE properties programatically?


Thanks.    <<Less

Re: Log to a different file for each class in Log4j

Posted By:   Christopher_Koenigsberg  
Posted On:   Wednesday, April 2, 2003 07:06 AM

Get a different Logger for each class, and configure so the different Loggers all go to different logfiles. Assuming you know the names of all the classes & Loggers, ahead of time, for the configuration (is that the problem, do you want to do something dynamic?).

About | Sitemap | Contact