Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.util
Class StandardLog

    java.lang.Object
      javolution.context.Context
          javolution.context.LogContext
              javolution.util.StandardLog

All Implemented Interfaces:
  java.io.Serializable, XMLSerializable

    public class StandardLog

extends LogContext

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.
         }

Version:
  5.3, March 13, 2007
Author:
  Jean-Marie Dautelle
See Also:
  Serialized Form

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.
`static boolean` | `isLoggable(java.util.logging.Level level)` Checks if a message of the given level would actually be logged by this logger.
`protected boolean` | `isLogged(java.lang.String category)` Indicates if the messages of the specified category are being logged (default `true` all messages are being logged).
`static void` | `log(java.util.logging.LogRecord record)` Logs a specific LogRecord.
`void` | `logDebug(java.lang.CharSequence message)` Logs the specified debug message.
`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.
`protected void` | `logMessage(java.lang.String category, java.lang.CharSequence message)` Logs the message of specified category (examples of category are "debug", "info", "warning", "error").
`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
`debug, debug, debug, debug, debug, debug, enterAction, error, error, error, error, error, exitAction, getCurrent, getDefault, info, info, info, info, info, info, isDebugLogged, isErrorLogged, isInfoLogged, isWarningLogged, warning, warning, warning, warning, 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

### StandardLog

    public StandardLog()

  Creates a logging context forwarding events to the root logger (`Logger.getLogger("")`).

### StandardLog

    public StandardLog(java.util.logging.Logger logger)

  Creates a standard log context forwarding events to the specified logger.

  Parameters:
    `logger` - the logger to which log events are forwarded to.

Method Detail

### getLogger

    public final java.util.logging.Logger getLogger()

  Returns the logger to which this context forwards the events to.

  Returns:
    the logger for this standard logging context.

### isLoggable

    public static boolean isLoggable(java.util.logging.Level level)

  Checks if a message of the given level would actually be logged by this logger.

  Parameters:
    `level` - the message logging level
  Returns:
    `true` if a message of specified level would actually be logged;`false` otherwise.

### log

    public static void log(java.util.logging.LogRecord record)

  Logs a specific LogRecord. If the current logging context is not a `StandardLog`, an `error`, `warning`, `info` or `debug` message is possibly logged.

  Parameters:
    `record` - the LogRecord to be published.

### severe

    public static void severe(java.lang.String msg)

  Logs a `SEVERE` message. If the current logging context is not a `StandardLog` a `error` message is logged.

  Parameters:
    `msg` - the severe message.

### config

    public static void config(java.lang.String msg)

  Logs a `CONFIG` message. If the current logging context is not a `StandardLog` no message is logged.

  Parameters:
    `msg` - the config message.

### fine

    public static void fine(java.lang.String msg)

  Logs a `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(java.lang.String msg)

  Logs a `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(java.lang.String msg)

  Logs a `FINEST` message. If the current logging context is not a `StandardLog` no message is logged.

  Parameters:
    `msg` - the finest message.

### throwing

    public static void throwing(java.lang.String sourceClass,
                                java.lang.String sourceMethod,
                                java.lang.Throwable thrown)

  Logs throwing an exception. If the current logging context is not a `StandardLog` an `error` is logged.

  Parameters:
    `sourceClass` - name of class that issued the logging request.
    `sourceMethod` - name of the method.
    `thrown` - the error that is being thrown.

### entering

    public static void entering(java.lang.String sourceClass,
                                java.lang.String sourceMethod)

  Log a method entry. If the current logging context is not a `StandardLog` a debug message is logged.

  Parameters:
    `sourceClass` - name of class that issued the logging request.
    `sourceMethod` - name of method that is being entered.

### exiting

    public static void exiting(java.lang.String sourceClass,
                               java.lang.String sourceMethod)

  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.
    `sourceMethod` - name of method that is being returned.

### isLogged

    protected boolean isLogged(java.lang.String category)

  Description copied from class: `LogContext`
  Indicates if the messages of the specified category are being logged (default `true` all messages are being logged).

  Note: This method is an indicator only, not a directive. It allows users to bypass the logging processing if no actual logging is performed. If the category is not known then this method should return `true` (no optimization performed).

  Overrides:
    `isLogged` in class `LogContext`
  Parameters:
    `category` - an identifier of the category for the messages logged.
  Returns:
    `true` if the messages of the specified category are being logged; `false` otherwise.

### logDebug

    public void logDebug(java.lang.CharSequence message)

  Description copied from class: `LogContext`
  Logs the specified debug message.

  Overrides:
    `logDebug` in class `LogContext`
  Parameters:
    `message` - the debug message to be logged.
  See Also:
    `LogContext.logMessage(java.lang.String, java.lang.CharSequence)`

### logInfo

    public void logInfo(java.lang.CharSequence message)

  Description copied from class: `LogContext`
  Logs the specified informative message.

  Overrides:
    `logInfo` in class `LogContext`
  Parameters:
    `message` - the informative message to be logged.

### logWarning

    public void logWarning(java.lang.CharSequence message)

  Description copied from class: `LogContext`
  Logs the specified warning message.

  Overrides:
    `logWarning` in class `LogContext`
  Parameters:
    `message` - the warning message to be logged.

### logError

    public void logError(java.lang.Throwable error,
                         java.lang.CharSequence message)

  Description copied from class: `LogContext`
  Logs the specified error. The default implementation logs the message and the error stack trace (calls `logMessage("", message + stackTrace)`.

  Overrides:
    `logError` in class `LogContext`
  Parameters:
    `error` - the error being logged or `null` if none.
    `message` - the associated message or `null` if none.

### logMessage

    protected void logMessage(java.lang.String category,
                              java.lang.CharSequence message)

  Description copied from class: `LogContext`
  Logs the message of specified category (examples of category are "debug", "info", "warning", "error").

  Specified by:
    `logMessage` in class `LogContext`
  Parameters:
    `category` - an identifier of the category of the messages logged.
    `message` - the message itself.

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.3 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2009 Javolution.