logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Curt Arnold <carn...@apache.org>
Subject Fwd: Appenders and Thresholds
Date Sat, 17 Nov 2007 22:10:30 GMT


Begin forwarded message:

> From: srikanth sampath <srikanth_sampath@yahoo.com>
> Date: November 16, 2007 5:25:12 PM CST
> To: carnold@apache.org
> Subject: Re: Appenders and Thresholds
>
> Hi,
> Any luck with this?
> Thanks,
> --Srikanth
>
>
> ----- Original Message ----
> From: srikanth sampath <srikanth_sampath@yahoo.com>
> To: carnold@apache.org
> Sent: Wednesday, November 14, 2007 4:14:49 PM
> Subject: Re: Appenders and Thresholds
>
> Hi,
> Here is the config file - It does not work
>
> # Root logger set to ALL using the A1 appender defined above.
> log4j.rootLogger=ALL, A1, C1
> log4j.debug=false
>
> # File appender A1.
> log4j.appender.A1=RollingFileAppender
> log4j.appender.A1.FileName=service.log
> log4j.appender.A1.MaxFileSize=100MB
> log4j.appender.A1.MaxBackupIndex=20
> log4j.appender.A1.threshold=INFO
> log4j.appender.A1.layout=PatternLayout
> log4j.appender.A1.layout.ConversionPattern=%d{ISO8601} [%t] %-5p %c 
> {2} %l - %m%n
>
> # Console appender C1 (WARN and above).
> log4j.appender.C1=ConsoleAppender
> log4j.appender.C1.threshold=WARN
> log4j.appender.C1.layout=PatternLayout
> log4j.appender.C1.layout.ConversionPattern=%d{ISO8601} [%t] %p %c -  
> %m%n
>
> Everything gets printed to the console.
>
> Thanks,
> --Srikanth
>
>
>
> ----- Original Message ----
> From: Curt Arnold <carnold@apache.org>
> To: Log4CXX User <log4cxx-user@logging.apache.org>
> Sent: Wednesday, November 14, 2007 11:31:52 AM
> Subject: Re: Appenders and Thresholds
>
>
> On Nov 9, 2007, at 4:08 PM, srikanth sampath wrote:
>
> > Hi,
> > Can we set thresholds per appender, for example - print everything
> > to a file, but only warnings and above to the Console.
> >
> > I see that thresholds can be set only to loggers, and does not work
> > with appenders.
> >
> > Thanks!
> > --Srikanth
> >
>
>
> Both log4j and log4cxx should support setting thresholds on
> appenders.  appenderskeleton.cpp does implement a setThreshold method
> and also setting the threshold using the setOption method which is
> should be enough to allow the configurators to work.  Did you try a
> configuration file that included setting the threshold on an appender
> and it did not work on log4cxx?  If so, could you share your
> configuration file?
>
>
>

Please send follow up messages to the list and not to the first  
person who responds or to the developers.  Keeping discussions on the  
list allows others to contribute and makes sure that all project  
decisions are visible and archived.

I've written a unit test to check that the appender thresholds can be  
set by property configuration and that they are effective in  
suppressing messages below the threshold.  However, the test passes  
just fine.  I also tried your log4j.properties file with a test  
application and everything works as expected.  Only messages of WARN  
or higher are displayed on the console.

Please try the following:

Make sure that you are using the current SVN HEAD.  No support can be  
offered for log4cxx 0.9.7.

Change log4j.debug=false to log4j.debug=true and see if you get any  
diagnostics.  If you don't see any differences, maybe you are getting  
your configuration from a different file.

If you still have problems, please provide additional details on bug  
report LOGCXX-207 (https://issues.apache.org/jira/browse/LOGCXX-207),  
specifically debug output from setting log4j.debug, operating system  
and compiler used and any other issues.  Please also check if the  
problem occurs in a trivial example (for example, src/examples/cpp/ 
trivial.cpp with the BasicConfigurator line removed) since there is  
the possibility that a complex app is modifying the configuration.


Mime
View raw message