Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.commons.logging.impl.SimpleLog
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
."simplelog.properties"
, and includes any matching definitions
from this resource (if it exists).
Field Summary | |
protected static String |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
static int |
|
protected int |
|
protected static DateFormat |
|
protected static String |
|
protected String |
|
private String |
|
protected static boolean |
|
protected static boolean |
|
protected static boolean |
|
protected static Properties |
|
protected static String |
|
Constructor Summary | |
|
Method Summary | |
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
private static boolean |
|
private static ClassLoader |
|
int |
|
private static InputStream |
|
private static String |
|
private static String |
|
void |
|
void |
|
boolean |
|
boolean |
|
boolean |
|
boolean |
|
protected boolean |
|
boolean |
|
boolean |
|
protected void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
protected void |
|
protected static final String DEFAULT_DATE_TIME_FORMAT
The default format to use when formating dates
public static final int LOG_LEVEL_ALL
Enable all logging levels
- Field Value:
- 0
public static final int LOG_LEVEL_DEBUG
"Debug" level logging.
- Field Value:
- 2
public static final int LOG_LEVEL_ERROR
"Error" level logging.
- Field Value:
- 5
public static final int LOG_LEVEL_FATAL
"Fatal" level logging.
- Field Value:
- 6
public static final int LOG_LEVEL_INFO
"Info" level logging.
- Field Value:
- 3
public static final int LOG_LEVEL_OFF
Enable no logging levels
- Field Value:
- 7
public static final int LOG_LEVEL_TRACE
"Trace" level logging.
- Field Value:
- 1
public static final int LOG_LEVEL_WARN
"Warn" level logging.
- Field Value:
- 4
protected int currentLogLevel
The current log level
protected static DateFormat dateFormatter
Used to format times
protected static String dateTimeFormat
The date and time format to use in the log message
protected String logName
The name of this simple log instance
private String shortLogName
The short name of this simple log instance
protected static boolean showDateTime
Include the current time in the log message
protected static boolean showLogName
Include the instance name in the log message?
protected static boolean showShortName
Include the short name ( last component ) of the logger in the log message. Defaults to true - otherwise we'll be lost in a flood of messages without knowing who sends them.
protected static final Properties simpleLogProps
Properties loaded from simplelog.properties
protected static final String systemPrefix
All system properties used bySimpleLog
start with this
public SimpleLog(String name)
Construct a simple log with given name.
- Parameters:
name
- log name
public final void debug(Object message)
Log a message with debug log level.
public final void debug(Object message, Throwable t)
Log an error with debug log level.
public final void error(Object message)
Log a message with error log level.
public final void error(Object message, Throwable t)
Log an error with error log level.
public final void fatal(Object message)
Log a message with fatal log level.
public final void fatal(Object message, Throwable t)
Log an error with fatal log level.
private static boolean getBooleanProperty(String name, boolean dephault)
private static ClassLoader getContextClassLoader()
Return the thread context class loader if available. Otherwise return null. The thread context class loader is available for JDK 1.2 or later, if certain security conditions are met.
public int getLevel()
Get logging level.
private static InputStream getResourceAsStream(String name)
private static String getStringProperty(String name)
private static String getStringProperty(String name, String dephault)
public final void info(Object message)
Log a message with info log level.
public final void info(Object message, Throwable t)
Log an error with info log level.
public final boolean isDebugEnabled()
Are debug messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isDebugEnabled in interface Log
public final boolean isErrorEnabled()
Are error messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isErrorEnabled in interface Log
public final boolean isFatalEnabled()
Are fatal messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isFatalEnabled in interface Log
public final boolean isInfoEnabled()
Are info messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isInfoEnabled in interface Log
protected boolean isLevelEnabled(int logLevel)
Is the given log level currently enabled?
- Parameters:
logLevel
- is this level enabled?
public final boolean isTraceEnabled()
Are trace messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isTraceEnabled in interface Log
public final boolean isWarnEnabled()
Are warn messages currently enabled? This allows expensive operations such asString
concatenation to be avoided when the message will be ignored by the logger.
- Specified by:
- isWarnEnabled in interface Log
protected void log(int type, Object message, Throwable t)
Do the actual logging. This method assembles the message and then callswrite()
to cause it to be written.
- Parameters:
type
- One of the LOG_LEVEL_XXX constants defining the log levelmessage
- The message itself (typically a String)t
- The exception whose stack trace should be logged
public void setLevel(int currentLogLevel)
Set logging level.
- Parameters:
currentLogLevel
- new logging level
public final void trace(Object message)
Log a message with trace log level.
public final void trace(Object message, Throwable t)
Log an error with trace log level.
public final void warn(Object message)
Log a message with warn log level.
public final void warn(Object message, Throwable t)
Log an error with warn log level.
protected void write(StringBuffer buffer)
Write the content of the message accumulated in the specifiedStringBuffer
to the appropriate output destination. The default implementation writes toSystem.err
.
- Parameters:
buffer
- AStringBuffer
containing the accumulated text to be logged