• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Log4j tw0 appenders problem

 
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to read on the concept of "additivity" in Log4J.

Checkout the Appenders and Layout section of this page.
 
Ganesh Gowtham
Ranch Hand
Posts: 225
IBM DB2 Eclipse IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're most welcome.
 
Paul Michael
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic