logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jaikiran pai <jai_forums2...@yahoo.co.in>
Subject Re: log4j extra level problem
Date Tue, 11 Jul 2006 11:10:41 GMT
I had a look at the code of log4j and here's what it does in the log method, which you are
calling:
   
  ---------------------
  /**
    This generic form is intended to be used by wrappers.
 */
  public
  void log(Priority priority, Object message) {
    if(repository.isDisabled(priority.level)) {
      return;
    }
    if(priority.isGreaterOrEqual(this.getEffectiveLevel()))
      forcedLog(FQCN, priority, message, null);
  }
  --------------------------
   
  And here's the implementation of priority.isGreaterOrEqual method:
   
  /**
     Returns <code>true</code> if this level has a higher or equal
     level than the level passed as argument, <code>false</code>
     otherwise.  
     
     <p>You should think twice before overriding the default
     implementation of <code>isGreaterOrEqual</code> method.
    */
  public
  boolean isGreaterOrEqual(Priority r) {
    return level >= r.level;
  }
   
  What's the integer value that you have given to your Level, that you created?
  If this method returns false, then your message wont be logged to the file.
   
  regards,
  -Jaikiran
   
   
   
   
   
   
   
  

Boris Lipsman <b_lipsman@yahoo.com> wrote:
  Hi,

This is what I have done:
Step1: Created MyLevelClass ( extends LEVEL ) with 2 extra levels declared
TRACE and METHOD_DEBUG_DETAILS
Step2: Created the wrapper around Logger ( log4j)
Step3: Added to the log4j.xml the following 
















Step4: Defined the category that referencing the appender







While, I start JBoss, all looks good, the trace level is beaing created(
I used to get before error messages that 
com.mywebapp.logging.MyExtraLevel is not found. But that was fixed by adding 
jar to the lib directory.

here is the scenario:
MyLogger myLogger = new MyLogger(SomeClass.class);
// MyLogger is a wrapper around Logger ( log4j)

myLogger.trace(); 
// trace() is actually calling generic log() method of the log4j
Strange thing, when I call the trace() method the message does not go 
anywhere.

Please help

Boris


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



 				
---------------------------------
 Find out what India is talking about on  Yahoo! Answers India.
 So, whatÂ’s NEW about the NEW Yahoo! Messenger? Find out.
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message