Documentation of 'javolution37.javolution.util.StandardLog' Java class
StandardLog
javolution37.javolution.util

Class StandardLog



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

    • Constructor Summary

      Constructors 
      Constructor and Description
      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

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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 void info(java.lang.String msg)
      Logs an INFO message.
      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.
      static void warning(java.lang.String msg)
      Logs a WARNING message.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, 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.
      • info

        public static void info(java.lang.String msg)
        Logs an INFO message.
        Parameters:
        msg - the informative message.
        See Also:
        LogContext.logInfo(CharSequence)
      • 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.
        message - the associated message or null if none.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.