Just to clarify, I'm not sure how your properties file can be getting huge
if you have only defined:
log4j.rootLogger=DEBUG, daily
log4j.appender.daily=org.apache.log4j.DailyRollingFileAppender

Is it just getting huge because you added all the additivity flags?


As for setting additivity "globally", you can specify additivity on the
rootLogger (that additivity setting is then "inherited" by all loggers
defined under it).  I.E.,
log4j.rootLogger=DEBUG, daily
log4j.additivity.rootLogger=false
log4j.appender.daily=org.apache.log4j.DailyRollingFileAppender


Also, even without setting it on the rootLogger, you would not need to do
this for each and every class.  Say you are using beanutils, as it appears
you are, then just include settings for the package level as such:
log4j.category.org.apache.commons.beanutils=WARN,daily
log4j.additivity.org.apache.commons.beanutils=false

That way you can also turn off logging all together for the beanutils
package just by doing:
log4j.category.org.apache.commons.beanutils=OFF
log4j.additivity.org.apache.commons.beanutils=false

Check out the log4j short manual
(http://jakarta.apache.org/log4j/docs/manual.html), especially the sections
on logger-hierarchies and appender-additivity.

HTH



    |-----Original Message-----
    |From: Wendy Smoak [mailto:[EMAIL PROTECTED]
    |Sent: Thursday, March 06, 2003 5:20 PM
    |To: Log4J Users List
    |Subject: Duplicate messages, help with log4j.properties
    |
    |
    |
    |My log4j.properties file is getting huge, and I'm sure I'm 
    |not doing this in
    |the most efficient way.  Basically, I have a Struts webapp 
    |running under
    |Tomcat, and I put a log4j.properties file sitting in 
    |WEB-INF/classes.
    |
    |I was immediately deluged with duplicate messages.  There 
    |are many posts
    |about this in the archives, and some mention 'additivity' 
    |which I read up
    |on.  But the only way I found to make them go away is to 
    |do this for every
    |class:
    |
    |  
    |log4j.category.org.apache.commons.beanutils.BeanUtils=WARN,daily   
    |  log4j.additivity.org.apache.commons.beanutils.BeanUtils=false
    |
    |  log4j.category.edu.asu.vpia.struts.ReminderForm=DEBUG, daily
    |  log4j.additivity.edu.asu.vpia.struts.ReminderForm=false
    |
    |Is there a way to set the additivity globally so I don't 
    |have to set it for
    |each class?  
    |
    |I'm not really sure why there are two of every message to 
    |begin with.  I've
    |only defined one appender:
    |
    |  log4j.rootLogger=DEBUG, daily
    |  log4j.appender.daily=org.apache.log4j.DailyRollingFileAppender
    |
    |I'm guessing that something in the Tomcat/Struts code is 
    |"seeing" my
    |log4j.properties file and using it.
    |
    |Thanks for any advice,
    |
    |-- 
    |Wendy Smoak
    |Applications Systems Analyst, Sr.
    |Arizona State University PA Information Resources Management
    |

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to