|
J avolution v5.2 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavolution.context.Context
javolution.context.LogContext
javolution.util.StandardLog
public class StandardLog
This class represents a specialized logging context forwarding events
to a standard logger (java.util.logging.Logger).
This class leverages the capabilities of the standard logging facility
and extends it to support specialized logging on a
thread or object basis. For example:
StandardLog remoteLog = new StandardLog(Logger.getLogger("remote"));
StandardLog.enter(remoteLog);
try {
StandardLog.fine("Current thread uses a remote logger");
...
} finally {
StandardLog.exit(remoteLog); // Reverts to previous logging context.
}
| Field Summary |
|---|
| Fields inherited from class javolution.context.LogContext |
|---|
CONSOLE, DEFAULT, NULL, STANDARD, SYSTEM_OUT |
| Fields inherited from class javolution.context.Context |
|---|
ROOT |
| Constructor Summary | |
|---|---|
StandardLog()
Creates a logging context forwarding events to the root logger ( Logger.getLogger("")). |
|
StandardLog(java.util.logging.Logger logger)
Creates a standard log context forwarding events to the specified logger. |
|
| Method Summary | |
|---|---|
static void |
config(java.lang.String msg)
Logs a CONFIG message. |
static void |
entering(java.lang.String sourceClass,
java.lang.String sourceMethod)
Log a method entry. |
static void |
exiting(java.lang.String sourceClass,
java.lang.String sourceMethod)
Log a method return. |
static void |
fine(java.lang.String msg)
Logs a FINE message. |
static void |
finer(java.lang.String msg)
Logs a FINER message. |
static void |
finest(java.lang.String msg)
Logs a FINEST message. |
java.util.logging.Logger |
getLogger()
Returns the logger to which this context forwards the events to. |
boolean |
isErrorLogged()
Indicates if errors are logged. |
boolean |
isInfoLogged()
Indicates if informative messages are logged. |
static boolean |
isLoggable(java.util.logging.Level level)
Checks if a message of the given level would actually be logged by this logger. |
boolean |
isWarningLogged()
Indicates if warning messages are logged. |
static void |
log(java.util.logging.LogRecord record)
Log a specific LogRecord. |
void |
logError(java.lang.Throwable error,
java.lang.CharSequence message)
Logs the specified error. |
void |
logInfo(java.lang.CharSequence message)
Logs the specified informative message. |
void |
logWarning(java.lang.CharSequence message)
Logs the specified warning message. |
static void |
severe(java.lang.String msg)
Logs a SEVERE message. |
static void |
throwing(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Throwable thrown)
Logs throwing an exception. |
| Methods inherited from class javolution.context.LogContext |
|---|
enterAction, error, error, error, error, error, exitAction, getCurrent, getDefault, info, info, logError, logInfo, logWarning, warning, warning |
| Methods inherited from class javolution.context.Context |
|---|
enter, enter, exit, exit, getOuter, getOwner, setCurrent, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public StandardLog()
Logger.getLogger("")).
public StandardLog(java.util.logging.Logger logger)
logger - the logger to which log events are forwarded to.| Method Detail |
|---|
public final java.util.logging.Logger getLogger()
public static boolean isLoggable(java.util.logging.Level level)
level - the message logging level
true if a message of specified level would actually
be logged;false otherwise.public static void log(java.util.logging.LogRecord record)
StandardLog, an error,
warning or
info is possibly logged.
record - the LogRecord to be published.public static void severe(java.lang.String msg)
SEVERE message. If the current logging
context is not a StandardLog a warning message is logged.
msg - the severe message.public static void config(java.lang.String msg)
CONFIG message. If the current logging
context is not a StandardLog no message is logged.
msg - the config message.public static void fine(java.lang.String msg)
FINE message. If the current logging
context is not a StandardLog no message is logged.
msg - the fine message.public static void finer(java.lang.String msg)
FINER message. If the current logging
context is not a StandardLog no message is logged.
msg - the finer message.public static void finest(java.lang.String msg)
FINEST message. If the current logging
context is not a StandardLog no message is logged.
msg - the finest message.
public static void throwing(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Throwable thrown)
StandardLog an error is logged.
sourceClass - name of class that issued the logging request.sourceMethod - name of the method.thrown - the error that is being thrown.
public static void entering(java.lang.String sourceClass,
java.lang.String sourceMethod)
StandardLog no entry is logged.
sourceClass - name of class that issued the logging request.sourceMethod - name of method that is being entered.
public static void exiting(java.lang.String sourceClass,
java.lang.String sourceMethod)
StandardLog no return is logged.
sourceClass - name of class that issued the logging request.sourceMethod - name of method that is being returned.public boolean isInfoLogged()
LogContext
isInfoLogged in class LogContexttrue if informative messages are logged;
false otherwise.public boolean isWarningLogged()
LogContext
isWarningLogged in class LogContexttrue if warnings message are logged;
false otherwise.public boolean isErrorLogged()
LogContext
isErrorLogged in class LogContexttrue if errors are logged;
false otherwise.public void logInfo(java.lang.CharSequence message)
LogContext
logInfo in class LogContextmessage - the informative message being logged.public void logWarning(java.lang.CharSequence message)
LogContext
logWarning in class LogContextmessage - the warning message being logged.
public void logError(java.lang.Throwable error,
java.lang.CharSequence message)
LogContext
logError in class LogContexterror - the error being logged or null if none.message - the associated message or null if none.
|
J avolution v5.2 (J2SE 1.5+) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||