db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/util/logging CommonsLoggerImpl.java
Date Fri, 02 Sep 2005 13:26:22 GMT
arminw      2005/09/02 06:26:22

  Modified:    src/java/org/apache/ojb/broker/util/logging Tag:
                        OJB_1_0_RELEASE CommonsLoggerImpl.java
  Log:
  fix bug, #isEnabledFor wasn't correct
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.4.2.1   +36 -21    db-ojb/src/java/org/apache/ojb/broker/util/logging/CommonsLoggerImpl.java
  
  Index: CommonsLoggerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/logging/CommonsLoggerImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.4.2.1
  diff -u -r1.4 -r1.4.2.1
  --- CommonsLoggerImpl.java	22 May 2004 10:03:02 -0000	1.4
  +++ CommonsLoggerImpl.java	2 Sep 2005 13:26:22 -0000	1.4.2.1
  @@ -41,10 +41,43 @@
   	public CommonsLoggerImpl(String aName)
   	{
   	    this.name = aName;
  -        this.log = LogFactory.getLog(aName);
   	}
   
  -	/**
  +    /**
  +	 * Returns the log.
  +	 * @return Log
  +	 */
  +	public Log getLog()
  +	{
  +		/*
  +		arminw: Log is declared 'transient', thus we have to null-check
  +		this field
  +		*/
  +        if(log == null)
  +        {
  +            log = LogFactory.getLog(name);
  +        }
  +        return log;
  +	}
  +
  +    /**
  +	 * @see org.apache.ojb.broker.util.logging.Logger#isEnabledFor(int)
  +	 */
  +	public boolean isEnabledFor(int priority)
  +	{
  +		Log commonsLog = getLog();
  +        switch(priority)
  +        {
  +            case Logger.DEBUG: return commonsLog.isDebugEnabled();
  +            case Logger.INFO: return commonsLog.isInfoEnabled();
  +            case Logger.WARN: return commonsLog.isWarnEnabled();
  +            case Logger.ERROR: return commonsLog.isErrorEnabled();
  +            case Logger.FATAL: return commonsLog.isFatalEnabled();
  +        }
  +        return false;
  +    }
  +
  +    /**
   	 * @see org.apache.ojb.broker.util.logging.Logger#debug(Object)
   	 */
   	public void debug(Object pObject)
  @@ -125,14 +158,6 @@
   	}
   
   	/**
  -	 * @see org.apache.ojb.broker.util.logging.Logger#isEnabledFor(int)
  -	 */
  -	public boolean isEnabledFor(int priority)
  -	{
  -		return false;
  -	}
  -
  -	/**
   	 * @see org.apache.ojb.broker.util.logging.Logger#isDebugEnabled()
   	 */
   	public boolean isDebugEnabled()
  @@ -295,14 +320,4 @@
   	{
   	    // do nothing
   	}
  -
  -	/**
  -	 * Returns the log.
  -	 * @return Log
  -	 */
  -	public Log getLog()
  -	{
  -		return log;
  -	}
  -
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message