| java.lang.Object org.apache.commons.discovery.log.SimpleLog
SimpleLog | public class SimpleLog implements Log(Code) | | Simple implementation of Log that sends all enabled log messages,
for all defined loggers, to System.err.
Hacked from commons-logging SimpleLog for use in discovery.
This is intended to be enough of a Log implementation to bootstrap
Discovery.
One property: org.apache.commons.discovery.log.level .
valid values: all, trace, debug, info, warn, error, fatal, off.
author: Richard A. Sitze author: Scott Sanders author: Rod Waldhoff author: Robert Burrell Donkin version: $Id: SimpleLog.java 480374 2006-11-29 03:33:25Z niallp $ |
Constructor Summary | |
public | SimpleLog(String name) Construct a simple log with given name. |
Method Summary | |
final public void | debug(Object message) | final public void | debug(Object message, Throwable t) | final public void | error(Object message) | final public void | error(Object message, Throwable t) | final public void | fatal(Object message) | final public void | fatal(Object message, Throwable t) | public static int | getLevel() Get logging level. | final public void | info(Object message) | final public void | info(Object message, Throwable t) | final public boolean | isDebugEnabled() Are debug messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | final public boolean | isErrorEnabled() Are error messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | final public boolean | isFatalEnabled() Are fatal messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | final public boolean | isInfoEnabled() Are info messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | protected static boolean | isLevelEnabled(int level) | final public boolean | isTraceEnabled() Are trace messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | final public boolean | isWarnEnabled() Are warn messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger. | protected void | log(int type, Object message, Throwable t) Do the actual logging. | public static void | setLevel(int currentLogLevel) Set logging level. | final public void | trace(Object message) | final public void | trace(Object message, Throwable t) | final public void | warn(Object message) | final public void | warn(Object message, Throwable t) |
LOG_LEVEL_ALL | final public static int LOG_LEVEL_ALL(Code) | | Enable all logging levels
|
LOG_LEVEL_DEBUG | final public static int LOG_LEVEL_DEBUG(Code) | | "Debug" level logging.
|
LOG_LEVEL_ERROR | final public static int LOG_LEVEL_ERROR(Code) | | "Error" level logging.
|
LOG_LEVEL_FATAL | final public static int LOG_LEVEL_FATAL(Code) | | "Fatal" level logging.
|
LOG_LEVEL_INFO | final public static int LOG_LEVEL_INFO(Code) | | "Info" level logging.
|
LOG_LEVEL_OFF | final public static int LOG_LEVEL_OFF(Code) | | Enable no logging levels
|
LOG_LEVEL_TRACE | final public static int LOG_LEVEL_TRACE(Code) | | "Trace" level logging.
|
LOG_LEVEL_WARN | final public static int LOG_LEVEL_WARN(Code) | | "Warn" level logging.
|
dateFormatter | protected static DateFormat dateFormatter(Code) | | Used to format times
|
logLevel | protected static int logLevel(Code) | | The current log level
|
logName | protected String logName(Code) | | The name of this simple log instance
|
showDateTime | protected static boolean showDateTime(Code) | | Include the current time in the log message
|
showLogName | protected static boolean showLogName(Code) | | Include the instance name in the log message?
|
showShortName | protected static boolean showShortName(Code) | | Include the short name ( last component ) of the logger in the log
message. Default to true - otherwise we'll be lost in a flood of
messages without knowing who sends them.
|
SimpleLog | public SimpleLog(String name)(Code) | | Construct a simple log with given name.
Parameters: name - log name |
debug | final public void debug(Object message)(Code) | | Log a message with debug log level.
|
error | final public void error(Object message)(Code) | | Log a message with error log level.
|
fatal | final public void fatal(Object message)(Code) | | Log a message with fatal log level.
|
getLevel | public static int getLevel()(Code) | | Get logging level.
|
info | final public void info(Object message)(Code) | | Log a message with info log level.
|
isDebugEnabled | final public boolean isDebugEnabled()(Code) | | Are debug messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
isErrorEnabled | final public boolean isErrorEnabled()(Code) | | Are error messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
isFatalEnabled | final public boolean isFatalEnabled()(Code) | | Are fatal messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
isInfoEnabled | final public boolean isInfoEnabled()(Code) | | Are info messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
isLevelEnabled | protected static boolean isLevelEnabled(int level)(Code) | | Is the given log level currently enabled?
Parameters: level - is this level enabled? |
isTraceEnabled | final public boolean isTraceEnabled()(Code) | | Are trace messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
isWarnEnabled | final public boolean isWarnEnabled()(Code) | | Are warn messages currently enabled?
This allows expensive operations such as String
concatenation to be avoided when the message will be ignored by the
logger.
|
log | protected void log(int type, Object message, Throwable t)(Code) | | Do the actual logging.
This method assembles the message
and then prints to System.err .
|
setLevel | public static void setLevel(int currentLogLevel)(Code) | | Set logging level.
Parameters: currentLogLevel - new logging level |
trace | final public void trace(Object message)(Code) | | Log a message with debug log level.
|
warn | final public void warn(Object message)(Code) | | Log a message with warn log level.
|
|
|