public class SimpleLog extends Object implements Log, Serializable
Simple implementation of Log that sends all enabled log messages, for all defined loggers, to System.err. The following system properties are supported to configure the behavior of this logger:
org.apache.commons.logging.simplelog.defaultlog - Default logging detail level for all instances of SimpleLog. Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, defaults to "info".org.apache.commons.logging.simplelog.log.xxxxx - Logging detail level for a SimpleLog instance named "xxxxx". Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). If not specified, the default logging detail level is used.org.apache.commons.logging.simplelog.showlogname - Set to true if you want the Log instance name to be included in output messages. Defaults to false.org.apache.commons.logging.simplelog.showShortLogname - Set to * true if you want the last component of the name to be included in output messages. Defaults to true.org.apache.commons.logging.simplelog.showdatetime - Set to true if you want the current date and time to be included in output messages. Default is false.org.apache.commons.logging.simplelog.dateTimeFormat - The date and time format to be used in the output messages. The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. If the format is not specified or is invalid, the default format is used. The default format is yyyy/MM/dd HH:mm:ss:SSS zzz. In addition to looking for system properties with the names specified above, this implementation also checks for a class loader resource named "simplelog.properties", and includes any matching definitions from this resource (if it exists).
| Modifier and Type | Field and Description |
|---|---|
protected int |
currentLogLevel |
protected static DateFormat |
dateFormatter |
protected static String |
dateTimeFormat |
protected static String |
DEFAULT_DATE_TIME_FORMAT |
static int |
LOG_LEVEL_ALL |
static int |
LOG_LEVEL_DEBUG |
static int |
LOG_LEVEL_ERROR |
static int |
LOG_LEVEL_FATAL |
static int |
LOG_LEVEL_INFO |
static int |
LOG_LEVEL_OFF |
static int |
LOG_LEVEL_TRACE |
static int |
LOG_LEVEL_WARN |
protected String |
logName |
protected static boolean |
showDateTime |
protected static boolean |
showLogName |
protected static boolean |
showShortName |
protected static Properties |
simpleLogProps |
protected static String |
systemPrefix |
| Modifier and Type | Method and Description |
|---|---|
void |
debug(Object message) |
void |
debug(Object message,
Throwable t) |
void |
error(Object message) |
void |
error(Object message,
Throwable t) |
void |
fatal(Object message) |
void |
fatal(Object message,
Throwable t) |
int |
getLevel() |
void |
info(Object message) |
void |
info(Object message,
Throwable t) |
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isFatalEnabled() |
boolean |
isInfoEnabled() |
protected boolean |
isLevelEnabled(int logLevel) |
boolean |
isTraceEnabled() |
boolean |
isWarnEnabled() |
protected void |
log(int type,
Object message,
Throwable t) |
void |
setLevel(int currentLogLevel) |
void |
trace(Object message) |
void |
trace(Object message,
Throwable t) |
void |
warn(Object message) |
void |
warn(Object message,
Throwable t) |
protected void |
write(StringBuffer buffer) |
protected static final String systemPrefix
protected static final Properties simpleLogProps
protected static final String DEFAULT_DATE_TIME_FORMAT
protected static boolean showLogName
protected static boolean showShortName
protected static boolean showDateTime
protected static String dateTimeFormat
protected static DateFormat dateFormatter
public static final int LOG_LEVEL_TRACE
public static final int LOG_LEVEL_DEBUG
public static final int LOG_LEVEL_INFO
public static final int LOG_LEVEL_WARN
public static final int LOG_LEVEL_ERROR
public static final int LOG_LEVEL_FATAL
public static final int LOG_LEVEL_ALL
public static final int LOG_LEVEL_OFF
protected String logName
protected int currentLogLevel
public SimpleLog(String name)
public void setLevel(int currentLogLevel)
public int getLevel()
protected void write(StringBuffer buffer)
protected boolean isLevelEnabled(int logLevel)
public final boolean isDebugEnabled()
isDebugEnabled in interface Logpublic final boolean isErrorEnabled()
isErrorEnabled in interface Logpublic final boolean isFatalEnabled()
isFatalEnabled in interface Logpublic final boolean isInfoEnabled()
isInfoEnabled in interface Logpublic final boolean isTraceEnabled()
isTraceEnabled in interface Logpublic final boolean isWarnEnabled()
isWarnEnabled in interface LogCopyright © 2014. All rights reserved.