You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bender Heri <HB...@Ergonomics.ch> on 2009/03/09 15:43:32 UTC

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: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 Fishman

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


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


Re: AW: [SPAM (Bayesain Analysis)] - Using log4j.properties to handle other properties - Bayesian Filter detected spam

Posted by Christophe Elek <ce...@ca.ibm.com>.
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: celek@ca.ibm.com

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" <HB...@Ergonomics.ch>                                                                                      
                                                                                                                                         
  To:         "Log4J Users List" <lo...@logging.apache.org>                                                                         
                                                                                                                                         
  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: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 Fishman

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


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