logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Brown <Matt.Br...@citrixOnline.com>
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?
Date Thu, 16 Apr 2009 16:37:32 GMT
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_98@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-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message