| |
|
| javolution.context.LogContext javolution.util.StandardLog
StandardLog | public class StandardLog extends LogContext (Code) | | 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
LogContext logging on a
thread or object basis. For example:[code]
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.
}[/code]
author: Jean-Marie Dautelle version: 5.1, August 1, 2007 |
Constructor Summary | |
public | StandardLog() Creates a logging context forwarding events to the root logger
(Logger.getLogger("") ). | public | StandardLog(Logger logger) Creates a standard log context forwarding events to the specified
logger. |
StandardLog | public StandardLog()(Code) | | Creates a logging context forwarding events to the root logger
(Logger.getLogger("") ).
|
StandardLog | public StandardLog(Logger logger)(Code) | | Creates a standard log context forwarding events to the specified
logger.
Parameters: logger - the logger to which log events are forwarded to. |
config | public static void config(String msg)(Code) | | Logs a
Level.CONFIG CONFIG message. If the current logging
context is not a
StandardLog no message is logged.
Parameters: msg - the config message. |
entering | public static void entering(String sourceClass, String sourceMethod)(Code) | | Log a method entry. If the current logging context is not a
StandardLog no entry is logged.
Parameters: sourceClass - name of class that issued the logging request. Parameters: sourceMethod - name of method that is being entered. |
exiting | public static void exiting(String sourceClass, String sourceMethod)(Code) | | Log a method return. If the current logging context is not a
StandardLog no return is logged.
Parameters: sourceClass - name of class that issued the logging request. Parameters: sourceMethod - name of method that is being returned. |
fine | public static void fine(String msg)(Code) | | Logs a
Level.FINE FINE message. If the current logging
context is not a
StandardLog no message is logged.
Parameters: msg - the fine message. |
finer | public static void finer(String msg)(Code) | | Logs a
Level.FINER FINER message. If the current logging
context is not a
StandardLog no message is logged.
Parameters: msg - the finer message. |
finest | public static void finest(String msg)(Code) | | Logs a
Level.FINEST FINEST message. If the current logging
context is not a
StandardLog no message is logged.
Parameters: msg - the finest message. |
getLogger | final public Logger getLogger()(Code) | | Returns the logger to which this context forwards the events to.
the logger for this standard logging context. |
isErrorLogged | public boolean isErrorLogged()(Code) | | |
isInfoLogged | public boolean isInfoLogged()(Code) | | |
isLoggable | public static boolean isLoggable(Level level)(Code) | | Checks if a message of the given level would actually be logged
by this logger.
Parameters: level - the message logging level true if a message of specified level would actuallybe logged;false otherwise. |
isWarningLogged | public boolean isWarningLogged()(Code) | | |
throwing | public static void throwing(String sourceClass, String sourceMethod, Throwable thrown)(Code) | | Logs throwing an exception. If the current logging context is not a
StandardLog an
LogContext.logError error is logged.
Parameters: sourceClass - name of class that issued the logging request. Parameters: sourceMethod - name of the method. Parameters: thrown - the error that is being thrown. |
|
|
|