Forums Register Login

Log4j tw0 appenders problem

+Pie Number of slices to send: Send
Hi Folks ,

I have two logging appenders like
log4j.appender.application = org.apache.log4j.RollingFileAppender
log4j.appender.sql = org.apache.log4j.RollingFileAppender

log4j.logger.com.infy=INFO, application
log4j.logger.com.infy.dao=INFO, sql

question is that in sql appenders i can see the sql debug statements
and the same can also been seen in application appenders also , i suspect because com.infy is superclass for com.infy.dao
it logs

what i need is what sql appenders logs , the same log i should not log in application appender
how can i dot that .
Please do help or suggest
+Pie Number of slices to send: Send
You might want to read on the concept of "additivity" in Log4J.

Checkout the Appenders and Layout section of this page.
+Pie Number of slices to send: Send
Hi Paul ,

Thanks a lot .

Issue had been fixed with writing these lines

log4j.category.com.infy.dao=INFO, sql
log4j.additivity.com.infy.dao=false
+Pie Number of slices to send: Send
You're most welcome.
+Pie Number of slices to send: Send
Before I forget, you might want to use the XML format for configuration instead of the properties file.

It is easier to read in my opinion and there are certain things you cannot do with the properties file which can only be done using XML config.

i.e. Setting up filters (if I remember correctly from the The Complete Log4j Manual book)

Hope this helps.
[ May 07, 2008: Message edited by: Paul Michael ]
Never trust an airline that limits their passengers to one carry on iguana. Put this tiny ad in your shoe:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1008 times.
Similar Threads
Log4j tw0 appenders problem
log4j writing to multiple log
Log4j in Eclipse Vs Log4j Outside Eclipse
thread safe logging in a servlet
Different Appender for each level
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 08:27:23.