Exactly. As Douglas points out you need to set the rootCategory to INFO.
Or, if you want to reduce the chatter from other components (e.g.
Spring) and your stuff is in the namespace com.mystuff then leave the
root logger alone and add:

log4j.logger.com.mystuff=INFO,...


On Wed, 2010-11-17 at 16:36 -0500, Douglas E Wegscheid wrote:
> um... aren't you only logging messages of severity on up for most loggers?
> 
> log4j.rootCategory=ERROR,...
> 
> how are you creating and using your logger?
> 
> 
> ■ DOUGLAS E. WEGSCHEID // LEAD ENGINEER
> (269) 923-5278 // douglas_e_wegsch...@whirlpool.com
> "A wrong note played hesitatingly is a wrong note. A wrong note played 
> with conviction is interpretation."
> 
> 
> 
> Henry Lu <z...@umich.edu> 
> 11/17/2010 03:51 PM
> Please respond to
> "Log4J Users List" <log4j-user@logging.apache.org>
> 
> 
> To
> Log4J Users List <log4j-user@logging.apache.org>
> cc
> 
> Subject
> Re: log4j and common logging
> 
> 
> 
> 
> 
> 
> Thank for your replying! Here are first several lines:
> 
> log4j: Trying to find [log4j.xml] using context classloader 
> EnvironmentClassLoader[web-app:http://localhost:8080].
> log4j: Trying to find [log4j.xml] using 
> sun.misc.launcher$appclassloa...@11b86e7 class loader.
> log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource().
> log4j: Trying to find [log4j.properties] using context classloader 
> EnvironmentClassLoader[web-app:http://localhost:8080].
> log4j: Using URL 
> [file:/C:/devel/projects/mtrain_trial/build/classes/log4j.properties] 
> for automatic log4j configuration.
> log4j: Reading configuration from URL 
> file:/C:/devel/projects/mtrain_trial/build/classes/log4j.properties
> log4j: Parsing for [root] with value=[ERROR, LogFile, Console].
> log4j: Level token is [ERROR].
> log4j: Category root set to ERROR
> log4j: Parsing appender named "LogFile".
> log4j: Parsing layout options for "LogFile".
> log4j: Setting property [conversionPattern] to [%d %-5p [%c{2}.%M] - %m
> ].
> log4j: End of parsing for "LogFile".
> log4j: Setting property [file] to [/var/applogs/mtrain.log].
> log4j: Setting property [maxFileSize] to [5MB;].
> log4j: Setting property [maxBackupIndex] to [30].
> log4j: Setting property [append] to [false].
> log4j: setFile called: /var/applogs/mtrain.log, false
> ...
> 
> In my log4j.property file, I have:
> 
> log4j.rootCategory=ERROR, LogFile, Console
> 
> 
> log4j.category.edu.umich.med.umms.mtrain=DEBUG
> log4j.logger.com.ibatis=DEBUG
> log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=DEBUG
> log4j.logger.com.ibatis.common.jdbc.ScriptRunner=DEBUG
> log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=DEBUG
> log4j.logger.java.sql.Connection=DEBUG
> log4j.logger.java.sql.Statement=DEBUG
> log4j.logger.java.sql.PreparedStatement=DEBUG
> 
> and I got all SQL debug info but not my app's info.
> 
> -Henry
> 
> On 11/17/2010 3:42 PM, Tim Watts wrote:
> > What does running the program with -Dlog4j.debug tell you? Stderr should
> > show what config file, if any, it's using.
> >
> >
> > On Wed, 2010-11-17 at 14:36 -0500, Henry Lu wrote:
> >> I tried to switch from log4j to org.apache.commons.logging.Log + log4j.
> >> I my code, I have:
> >>
> >> import org.apache.commons.logging.Log;
> >> import org.apache.commons.logging.LogFactory;
> >> ...
> >>
> >> public class XYZ
> >> {
> >>      static Log log = LogFactory.getLog("Xyz");
> >> ...
> >> }
> >>
> >> and I am using the existing log4j.property file which works fine for 
> log4j.
> >>
> >> There is no compile error at all.
> >>
> >> But when I run the program, there is no log info at all.
> >> why?
> >>
> >> -Henry
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> >
> 
> ---------------------------------------------------------------------
> 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

Reply via email to