You have this configuration: log4j.logger.package1.delegate=ERROR, database1 log4j.logger.package1.delegate=ERROR, database2
Yet with this code, you are using the loggers named "databaselog1" and "databaselog2": private static Logger logger1 = Logger.getLogger("databaselog1"); private static Logger logger2 = Logger.getLogger("databaselog2"); So you should be configuring it like this log4j.logger.databaselog1=ERROR, database1 log4j.logger.databaselog2=ERROR, database2 But also, if you only configure the logger to log at ERROR level, then when you log with log.info() in the actual source code, this INFO level message will be ignored, since it falls below the threshold. For your testing, try log4j.logger.databaselog1=ALL, database1 log4j.logger.databaselog2=ALL, database2 -----Original Message----- From: Vani Bandargal [mailto:vanims...@hotmail.com] Sent: Thursday, April 16, 2009 12:31 PM To: log4j-user@logging.apache.org Subject: RE: Is there any way to output the log statemts from a particular method to a different log file other than what is configued for that package? I have attched the log4J properties file and a sample delegate that I used. Please take a look. Appreciate if you point out what I am missing. All my log statements are printed in root.log. They are neither going to databaselog1 and nor to databaselog2 http://www.nabble.com/file/p23081601/Log4J.properties.txt Log4J.properties.txt http://www.nabble.com/file/p23081601/SampleDelegate.txt SampleDelegate.txt -- View this message in context: http://www.nabble.com/Is-there-any-way-to-output-the-log-statemts-from-a-particular-method-to-a-different-log-file-other-than-what-is-configued-for-that-package--tp23078688p23081601.html Sent from the Log4j - Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org