org.apache.juli.logging.Log
package org.apache.juli.logging;/**
* 日志接口API。为了能够被LogFactory实例,实现这个Log接口的类必须要包含
* 含有单个字符串作为参数的构造函数,这个字符串参数用来作为日志的名字。
* Log含有6个日志级别:
* trace
* debug
* info
* warn
* error
* fatal
*
* The mapping of these log levels to the concepts used by the underlying
* logging system is implementation dependent.
* The implementation should ensure, though, that this ordering behaves
* as expected.
*
* Performance is often a logging concern.
* By examining the appropriate property,
* a component can avoid expensive operations (producing information
* to be logged).
*
*For example,
*
* if (log.isDebugEnabled()) {
* ... do something expensive ...
* log.debug(theResult);
* }
*
*
*
* Configuration of the underlying logging system will generally be done
* external to the Logging APIs, through whatever mechanism is supported by
* that system.
*
* @author Scott Sanders
* @author Rod Waldhoff
*/
public interface Log {
// ----------------------------------------------------- Logging Properties
/**
*Is debug logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than debug.
*/
public boolean isDebugEnabled();
/**
*Is error logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than error.
*/
public boolean isErrorEnabled();
/**
*Is fatal logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than fatal.
*/
public boolean isFatalEnabled();
/**
*Is info logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than info.
*/
public boolean isInfoEnabled();
/**
*Is trace logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than trace.
*/
public boolean isTraceEnabled();
/**
*Is warn logging currently enabled?
*
*Call this method to prevent having to perform expensive operations
* (for example, String concatenation)
* when the log level is more than warn.
*/
public boolean isWarnEnabled();
// -------------------------------------------------------- Logging Methods
/**
*Log a message with trace log level.
*
* @param message log this message
*/
public void trace(Object message);
/**
*Log an error with trace log level.
*
* @param message log this message
* @param t log this cause
*/
public void trace(Object message, Throwable t);
/**
*Log a message with debug log level.
*
* @param message log this message
*/
public void debug(Object message);
/**
*Log an error with debug log level.
*
* @param message log this message
* @param t log this cause
*/
public void debug(Object message, Throwable t);
/**
*Log a message with info log level.
*
* @param message log this message
*/
public void info(Object message);
/**
*Log an error with info log level.
*
* @param message log this message
* @param t log this cause
*/
public void info(Object message, Throwable t);
/**
*Log a message with warn log level.
*
* @param message log this message
*/
public void warn(Object message);
/**
*Log an error with warn log level.
*
* @param message log this message
* @param t log this cause
*/
public void warn(Object message, Throwable t);
/**
*Log a message with error log level.
*
* @param message log this message
*/
public void error(Object message);
/**
*Log an error with error log level.
*
* @param message log this message
* @param t log this cause
*/
public void error(Object message, Throwable t);
/**
*Log a message with fatal log level.
*
* @param message log this message
*/
public void fatal(Object message);
/**
*Log an error with fatal log level.
*
* @param message log this message
* @param t log this cause
*/
public void fatal(Object message, Throwable t);
}
页:
[1]