Hey Heri,
Thanks

ummm.... you bring a good point,
The myStatisticLogger.isInfoEnabled() would be my boolean... :) Thx much :)

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: [email protected]

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

Web:http://www.ibm.com/software/rational/


                                                                       
  From:       "Bender Heri" <[email protected]>                    
                                                                       
  To:         "Log4J Users List" <[email protected]>       
                                                                       
  Date:       03/09/2009 10:51 AM                                      
                                                                       
  Subject:    AW: [SPAM (Bayesain Analysis)] - Using log4j.properties to handle 
other properties - Bayesian Filter detected spam
                                                                       





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()..." );
   count++;
   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.

Heri


-----Ursprüngliche Nachricht-----
Von: Christophe Elek [mailto:[email protected]]
Gesendet: Montag, 9. März 2009 15:09
An: [email protected]
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: [email protected]

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

Web:http://www.ibm.com/software/rational/


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to