logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Javier Gonzalez" <jagon...@gmail.com>
Subject Re: Double Logging
Date Thu, 30 Mar 2006 21:24:19 GMT
The downside is that "errant" log messages won't reach any logs. An error in
some framework, for example. If you have specified
appenders for every "branch" of your logger hierachy, there should be no
problem. However, insuring that isn't easy.

Usually I leave the root logger at WARN level, and for the loggers that like
to spit a lot of info I disable additivity.

On 3/30/06, Tim Watts <timtw@earthlink.net> wrote:
>
> On Thursday 30 March 2006 15:44, Javier Gonzalez wrote:
> > A way to fix this is to
> > set additivity in your loggers to false. The other one is to implement
> your
> > appenders with additivity in mind.
>
> Thanks for the quick response. A third way is to comment out the
> rootCategory.
> What's the down-side to that?
>
> >
> > > The other weird thing is that although the log level is set for INFO,
> > > only warn or greater gets logged. I turned log4j.debug on and verified
> > > that it's
> > > finding the correct file.  What's going on?
> >
> > I see your test code sends warn level messages - have you tried it with
> > logger.info(), logger.debug()?
> >
> > According to your config file, you should see Warn or higher at the
> > console, and all messages in the log file. Does this happen?
>
> Yes. I saw that after I sent the email. Thanks again for your time.
>
> >
> >
> > == begin cfg ===================================
> >
> > > # Set root category priority to INFO and its only appender to CONSOLE.
> > > log4j.rootCategory=WARN, CONSOLE, LOGFILE
> > > #log4j.rootCategory=INFO, CONSOLE, LOGFILE
> > >
> > > log4j.logger.com.inxight=INFO, CONSOLE, LOGFILE
> > > log4j.logger.org.apache=WARN, CONSOLE, LOGFILE
> > > log4j.logger.servletunit=WARN, CONSOLE, LOGFILE
> > >
> > > # Set the enterprise logger category to FATAL and its only appender to
> > > CONSOLE.
> > > log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
> > >
> > > # CONSOLE is set to be a ConsoleAppender using a PatternLayout.
> > > log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
> > > log4j.appender.CONSOLE.Threshold=WARN
> > > log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.CONSOLE.layout.ConversionPattern=- %m%n
> > >
> > > # LOGFILE is set to be a File appender using a PatternLayout.
> > > log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
> > > log4j.appender.LOGFILE.File=${user.home}/sdxadminui.log
> > > log4j.appender.LOGFILE.Append=true
> > > log4j.appender.LOGFILE.MaxFileSize=5MB
> > > log4j.appender.LOGFILE.MaxBackupIndex=1
> > > log4j.appender.LOGFILE.Threshold=DEBUG
> > > log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
> > > log4j.appender.LOGFILE.layout.ConversionPattern=%d [%t] %-5p %c %x -
> %m%n
> > > == end cfg ===================================
> > >
> > > == begin pgm ===================================
> > > package com.inxight.sdx.adminui;
> > >
> > > import org.apache.log4j.Logger;
> > >
> > > public class LogTest {
> > >
> > >     /**
> > >      * @param args
> > >      */
> > >     public static void main(String[] args) {
> > >         Logger logger = Logger.getLogger(LogTest.class);
> > >         logger.warn("this is a test.");
> > >     }
> > >
> > > }
> > > == end pgm===================================
> > >
> > > == begin classpath ===================================
> > > CLASSPATH=WebSite/WEB-INF/classes/
> > > CLASSPATH=$CLASSPATH:bin
> > > CLASSPATH=$CLASSPATH:WebSite/WEB-INF/lib/log4j-1.2.8.jar
> > > export CLASSPATH
> > > == end classpath ===================================
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> > --
> > Javier González Nicolini
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


--
Javier González Nicolini

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message