Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (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.1, August 1, 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.
`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

### 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)

  Log a specific LogRecord. If the current logging context is not a `StandardLog`, an `error`, `warning` or `info` 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 `warning` 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` no entry 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.

### isInfoLogged

    public boolean isInfoLogged()

  Description copied from class: `LogContext`
  Indicates if informative messages are logged.

  Specified by:
    `isInfoLogged` in class `LogContext`
  Returns:
    `true` if informative messages are logged; `false` otherwise.

### isWarningLogged

    public boolean isWarningLogged()

  Description copied from class: `LogContext`
  Indicates if warning messages are logged.

  Specified by:
    `isWarningLogged` in class `LogContext`
  Returns:
    `true` if warnings message are logged; `false` otherwise.

### isErrorLogged

    public boolean isErrorLogged()

  Description copied from class: `LogContext`
  Indicates if errors are logged.

  Specified by:
    `isErrorLogged` in class `LogContext`
  Returns:
    `true` if errors are logged; `false` otherwise.

### logInfo

    public void logInfo(java.lang.CharSequence message)

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

  Specified by:
    `logInfo` in class `LogContext`
  Parameters:
    `message` - the informative message being logged.

### logWarning

    public void logWarning(java.lang.CharSequence message)

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

  Specified by:
    `logWarning` in class `LogContext`
  Parameters:
    `message` - the warning message being logged.

### logError

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

  Description copied from class: `LogContext`
  Logs the specified error.

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

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

Copyright © 2005 - 2007 Javolution.