FileDocCategorySizeDatePackage
CommonsLogger.javaAPI DocApache Poi 3.0.13695Mon Jan 01 12:39:42 GMT 2007org.apache.poi.util

CommonsLogger

public class CommonsLogger extends POILogger
A logger class that strives to make it as easy as possible for developers to write log calls, while simultaneously making those calls as cheap as possible by performing lazy evaluation of the log message.

author
Marc Johnson (mjohnson at apache dot org)
author
Glen Stampoultzis (glens at apache.org)
author
Nicola Ken Barozzi (nicolaken at apache.org)

Fields Summary
private static LogFactory
_creator
private Log
log
Constructors Summary
Methods Summary
public booleancheck(int level)
Check if a logger is enabled to log at the specified level

param
level One of DEBUG, INFO, WARN, ERROR, FATAL

        if(level==FATAL)
        {
          if(log.isFatalEnabled())
          {
            return true;
          }
        }
        else if(level==ERROR)
        {
          if(log.isErrorEnabled())
          {
            return true;
          }
        }
        else if(level==WARN)
        {
          if(log.isWarnEnabled())
          {
            return true;
          }
        }
        else if(level==INFO)
        {
          if(log.isInfoEnabled())
          {
            return true;
          }
        }
        else if(level==DEBUG)
        {
          if(log.isDebugEnabled())
          {
            return true;
          }
        }

        return false;

    
public voidinitialize(java.lang.String cat)


   
        
    
        this.log = _creator.getInstance(cat);
    
public voidlog(int level, java.lang.Object obj1)
Log a message

param
level One of DEBUG, INFO, WARN, ERROR, FATAL
param
obj1 The object to log.

        if(level==FATAL)
        {
          if(log.isFatalEnabled())
          {
            log.fatal(obj1);
          }
        }
        else if(level==ERROR)
        {
          if(log.isErrorEnabled())
          {
            log.error(obj1);
          }
        }
        else if(level==WARN)
        {
          if(log.isWarnEnabled())
          {
            log.warn(obj1);
          }
        }
        else if(level==INFO)
        {
          if(log.isInfoEnabled())
          {
            log.info(obj1);
          }
        }
        else if(level==DEBUG)
        {
          if(log.isDebugEnabled())
          {
            log.debug(obj1);
          }
        }
        else
        {
          if(log.isTraceEnabled())
          {
            log.trace(obj1);
          }
        }