logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bender Heri" <HBen...@Ergonomics.ch>
Subject AW: [SPAM (Bayesain Analysis)] - Using log4j.properties to handle other properties - Bayesian Filter detected spam
Date Mon, 09 Mar 2009 14:43:32 GMT
I assume you mean following (pseudo code)

If SystempropertyCollectStatistics==True
    myLog.info( ... )

The correct way would be to use a special named logger and declare it in the propeties file
with the desired log level.

Possible code in class with statstic logging needs:

 Logger myNormalDebugLogger = Logger.getLogger( <CLASS> );
 Logger myStatisticLogger = Logger.getLogger( "StatisticLogger" )
 static int count = 0;

void foo()
   myNormalDebugLogger.debug( "entering foo()..." );
   if myStatisticLogger.isInfoEnabled()
      myStatisticLogger.info( "foo() called now " + count + " times" );

Within the configuration file you can enable the statistics by setting the level of "StatisticLogger"
to INFO, disable it by setting it to WARN or OFF.


-----Ursprüngliche Nachricht-----
Von: Christophe Elek [mailto:celek@ca.ibm.com] 
Gesendet: Montag, 9. März 2009 15:09
An: log4j-user@logging.apache.org
Betreff: [SPAM (Bayesain Analysis)] - Using log4j.properties to handle other properties -
Bayesian Filter detected spam

My developers are using System Properties to enable certain trace options (like collecting
statistics) Is there a way I could define such property in the log4j.properties instead so
we keep trace/log options and metadata together ?

So my developers will do
<aLog 4J object>.getProperty('my property') instead of System.getProperty() ?

Christophe Elek - Senior Software Analyst IBM Rational Serviceability Architect IBM Toronto
Lab 8200 Warden Avenue, Markham, Ontario, L6G 1C7 Phone Number: (905) 413-3467
Email: celek@ca.ibm.com

Rational Internal Serviceability Portal
"Don't just fix the mistakes - fix whatever permitted the mistake in the first place." Charles


To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message