|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.util.Log
public final class Log
The log services provide debug, info and warning message logging
capabilities for a set of modules. These log services are designed to
provide the basic functionality needed by the samskivert codebase. It
is expected that the LogProvider interface will be used to
map these log services onto whatever more general purpose logging
framework is in use by the user of the samskivert codebase.
The log provider can be set via a system property to ensure that it
is in effect as soon as the log services are used. When invoking your
JVM, specify -Dlog_provider=classname and it will
automatically be instantiated and put into effect by the log services.
If your log provider needs more sophisticated configuration, you'll
have to instantiate it yourself and set it using setLogProvider(com.samskivert.util.LogProvider).
| Field Summary | |
|---|---|
protected String |
_moduleName
The name of the module to which this log instance is associated. |
protected static LogProvider |
_provider
The log provider currently in use by the log services. |
static int |
DEBUG
Log level constant for debug entries. |
static int |
INFO
Log level constant for info entries. |
static int |
WARNING
Log level constant for warning entries. |
| Constructor Summary | |
|---|---|
Log(String moduleName)
Constructs a new log object with the supplied module name. |
|
| Method Summary | |
|---|---|
void |
debug(String message)
Logs the specified message at the debug level if such messages are enabled. |
static int |
getLevel()
Returns the default log level for all modules. |
static int |
getLevel(String moduleName)
Returns the log level of the specified module. |
static LogProvider |
getLogProvider()
Returns the log provider currently in use by the logging services. |
protected static void |
inferConfiguration()
Checks the log_provider system property to see if a
log provider has been specified. |
void |
info(String message)
Logs the specified message at the info level if such messages are enabled. |
static int |
levelFromString(String level)
Returns the log level that matches the specified string or -1 if the string could not be interpretted as a log level. |
static String |
levelToString(int level)
Returns a string representation of the specified log level. |
void |
logStackTrace(int level,
Throwable t)
Logs the stack trace of the supplied throwable at the specified level (if the current log level for this module is at or below the specified level). |
static void |
setLevel(int level)
Sets the log level for all modules to the specified level. |
static void |
setLevel(String moduleName,
int level)
Sets the log level of the specified module to the specified value. |
static void |
setLogProvider(LogProvider provider)
Instructs the logging services to use the specified log provider to perform the actual logging. |
void |
warning(String message)
Logs the specified message at the warning level if such messages are enabled. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEBUG
public static final int INFO
public static final int WARNING
protected String _moduleName
protected static LogProvider _provider
| Constructor Detail |
|---|
public Log(String moduleName)
| Method Detail |
|---|
public void debug(String message)
public void info(String message)
public void warning(String message)
public void logStackTrace(int level,
Throwable t)
public static void setLevel(String moduleName,
int level)
public static void setLevel(int level)
public static int getLevel(String moduleName)
public static int getLevel()
public static LogProvider getLogProvider()
public static void setLogProvider(LogProvider provider)
public static int levelFromString(String level)
public static String levelToString(int level)
protected static void inferConfiguration()
log_provider system property to see if a
log provider has been specified. Installs it if so. Checks the
log_level system property to see if a default log
level has been specified. Sets it if so.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||