org.objectweb.cjdbc.common.log
Class StaticDisabledLogger

java.lang.Object
  extended byorg.objectweb.cjdbc.common.log.Trace
      extended byorg.objectweb.cjdbc.common.log.StaticDisabledLogger

public class StaticDisabledLogger
extends Trace

This is a wrapper where logging has been statically disabled. It should improve the performance if one wants to completely disable traces.

Version:
1.0
Author:
Emmanuel Cecchet

Field Summary
 
Fields inherited from class org.objectweb.cjdbc.common.log.Trace
 
Constructor Summary
StaticDisabledLogger(org.apache.log4j.Logger log4jLogger)
          Creates a new StaticDisabledLogger object from a given log4j Logger.
 
Method Summary
 void debug(java.lang.Object message)
          This method is overriden with an empty body.
 void debug(java.lang.Object message, java.lang.Throwable t)
          This method is overriden with an empty body.
 void error(java.lang.Object message)
          This method is overriden with an empty body.
 void error(java.lang.Object message, java.lang.Throwable t)
          This method is overriden with an empty body.
 void fatal(java.lang.Object message)
          This method is overriden with an empty body.
 void fatal(java.lang.Object message, java.lang.Throwable t)
          This method is overriden with an empty body.
 void info(java.lang.Object message)
          This method is overriden with an empty body.
 void info(java.lang.Object message, java.lang.Throwable t)
          This method is overriden with an empty body.
 boolean isDebugEnabled()
          Checks whether this category is enabled for the DEBUG Level.
 boolean isErrorEnabled()
          Checks whether this category is enabled for the INFO Level.
 boolean isFatalEnabled()
          Checks whether this category is enabled for the INFO Level.
 boolean isInfoEnabled()
          Checks whether this category is enabled for the INFO Level.
 boolean isWarnEnabled()
          Checks whether this category is enabled for the INFO Level.
 void warn(java.lang.Object message)
          This method is overriden with an empty body.
 void warn(java.lang.Object message, java.lang.Throwable t)
          This method is overriden with an empty body.
 
Methods inherited from class org.objectweb.cjdbc.common.log.Trace
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticDisabledLogger

public StaticDisabledLogger(org.apache.log4j.Logger log4jLogger)
Creates a new StaticDisabledLogger object from a given log4j Logger.

Parameters:
log4jLogger - the log4j Logger
Method Detail

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable t)
This method is overriden with an empty body.

Overrides:
debug in class Trace
Parameters:
message - the message object to log
t - the exception to log, including its stack trace
See Also:
Trace.debug(Object, Throwable)

debug

public void debug(java.lang.Object message)
This method is overriden with an empty body.

Overrides:
debug in class Trace
Parameters:
message - the message object to log
See Also:
Trace.debug(Object)

error

public void error(java.lang.Object message,
                  java.lang.Throwable t)
This method is overriden with an empty body.

Overrides:
error in class Trace
Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.
See Also:
Trace.error(Object, Throwable)

error

public void error(java.lang.Object message)
This method is overriden with an empty body.

Overrides:
error in class Trace
Parameters:
message - the message object to log
See Also:
Trace.error(Object)

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable t)
This method is overriden with an empty body.

Overrides:
fatal in class Trace
Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.
See Also:
Trace.fatal(Object, Throwable)

fatal

public void fatal(java.lang.Object message)
This method is overriden with an empty body.

Overrides:
fatal in class Trace
Parameters:
message - the message object to log.
See Also:
Trace.fatal(Object)

info

public void info(java.lang.Object message,
                 java.lang.Throwable t)
This method is overriden with an empty body.

Overrides:
info in class Trace
Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.
See Also:
Trace.info(Object, Throwable)

info

public void info(java.lang.Object message)
This method is overriden with an empty body.

Overrides:
info in class Trace
Parameters:
message - the message object to log.
See Also:
Trace.info(Object)

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable t)
This method is overriden with an empty body.

Overrides:
warn in class Trace
Parameters:
message - the message object to log.
t - the exception to log, including its stack trace.
See Also:
Trace.warn(Object, Throwable)

warn

public void warn(java.lang.Object message)
This method is overriden with an empty body.

Overrides:
warn in class Trace
Parameters:
message - the message object to log.
See Also:
Trace.warn(Object)

isDebugEnabled

public boolean isDebugEnabled()
Description copied from class: Trace
Checks whether this category is enabled for the DEBUG Level.

This function is intended to lessen the computational cost of disabled log debug statements.

For some cat Category object, when you write,

  cat.debug("This is entry number: " + i );
 

You incur the cost constructing the message, concatenatiion in this case, regardless of whether the message is logged or not.

If you are worried about speed, then you should write

  if(cat.isDebugEnabled()) { cat.debug("This is entry number: " + i ); }
 

This way you will not incur the cost of parameter construction if debugging is disabled for cat. On the other hand, if the cat is debug enabled, you will incur the cost of evaluating whether the category is debug enabled twice. Once in isDebugEnabled and once in the debug. This is an insignificant overhead since evaluating a category takes about 1%% of the time it takes to actually log.

Overrides:
isDebugEnabled in class Trace
Returns:
false
See Also:
Trace.isDebugEnabled()

isErrorEnabled

public boolean isErrorEnabled()
Description copied from class: Trace
Checks whether this category is enabled for the INFO Level. See also Trace.isDebugEnabled().

Overrides:
isErrorEnabled in class Trace
Returns:
false
See Also:
Trace.isErrorEnabled()

isFatalEnabled

public boolean isFatalEnabled()
Description copied from class: Trace
Checks whether this category is enabled for the INFO Level. See also Trace.isDebugEnabled().

Overrides:
isFatalEnabled in class Trace
Returns:
false
See Also:
Trace.isFatalEnabled()

isInfoEnabled

public boolean isInfoEnabled()
Description copied from class: Trace
Checks whether this category is enabled for the INFO Level. See also Trace.isDebugEnabled().

Overrides:
isInfoEnabled in class Trace
Returns:
false
See Also:
Trace.isInfoEnabled()

isWarnEnabled

public boolean isWarnEnabled()
Description copied from class: Trace
Checks whether this category is enabled for the INFO Level. See also Trace.isDebugEnabled().

Overrides:
isWarnEnabled in class Trace
Returns:
false
See Also:
Trace.isWarnEnabled()


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.