Package net.spy.memcached.compat.log
Class Log4JLogger
- java.lang.Object
-
- net.spy.memcached.compat.log.AbstractLogger
-
- net.spy.memcached.compat.log.Log4JLogger
-
- All Implemented Interfaces:
Logger
public class Log4JLogger extends AbstractLogger
Logging implementation using log4j.
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.log4j.Loggerl4jLogger
-
Constructor Summary
Constructors Constructor Description Log4JLogger(java.lang.String name)Get an instance of Log4JLogger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisDebugEnabled()True if debug is enabled for this logger.booleanisInfoEnabled()True if debug is enabled for this logger.booleanisTraceEnabled()Checks whether TRACE logging is enabled.voidlog(Level level, java.lang.Object message, java.lang.Throwable e)Wrapper around log4j.
-
-
-
Method Detail
-
isTraceEnabled
public boolean isTraceEnabled()
Description copied from interface:LoggerChecks whether TRACE logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:if (log.isTraceEnabled()) { ... expensive code here ... log.trace(result); }- Returns:
- true if trace messages would be displayed.
-
isDebugEnabled
public boolean isDebugEnabled()
Description copied from class:AbstractLoggerTrue if debug is enabled for this logger. Default implementation always returns false- Specified by:
isDebugEnabledin interfaceLogger- Specified by:
isDebugEnabledin classAbstractLogger- Returns:
- true if debug messages would be displayed
-
isInfoEnabled
public boolean isInfoEnabled()
Description copied from class:AbstractLoggerTrue if debug is enabled for this logger. Default implementation always returns false- Specified by:
isInfoEnabledin interfaceLogger- Specified by:
isInfoEnabledin classAbstractLogger- Returns:
- true if info messages would be displayed
-
log
public void log(Level level, java.lang.Object message, java.lang.Throwable e)
Wrapper around log4j.- Specified by:
login interfaceLogger- Specified by:
login classAbstractLogger- Parameters:
level- net.spy.compat.log.Level level.message- object messagee- optional throwable
-
-