org.universAAL.middleware.container.utils
Class LogUtils

Package class diagram package LogUtils
java.lang.Object
  extended by org.universAAL.middleware.container.utils.LogUtils

public class LogUtils
extends Object

Logging utility class. Call one of the static methods of this class to add new log entries to a logger. Log entries may also be forwarded to various other LogListeners.

Security considerations:
Since the log entries are forwarded to custom log listeners, the msgPart should contain only unmodifiable content.

Author:
mtazari, Carsten Stockloew

Constructor Summary
LogUtils()
           
 
Method Summary
static void logDebug(ModuleContext mc, Class claz, String method, Object[] msgPart, Throwable t)
          Provides a standard way for using container-specific loggers for logging debug messages via ModuleContext.logDebug(String, String, Throwable).
static void logDebug(ModuleContext mc, Class claz, String method, String msg)
          Simplified proxy method for logDebug(ModuleContext, Class, String, Object[], Throwable), added for convenience.
static void logError(ModuleContext mc, Class claz, String method, Object[] msgPart, Throwable t)
          Provides a standard way for using container-specific loggers for logging error messages via ModuleContext.logError(String, String, Throwable).
static void logError(ModuleContext mc, Class claz, String method, String msg)
          Simplified proxy method for logError(ModuleContext, Class, String, Object[], Throwable), added for convenience.
static void logInfo(ModuleContext mc, Class claz, String method, Object[] msgPart, Throwable t)
          Provides a standard way for using container-specific loggers for logging info messages via ModuleContext.logInfo(String, String, Throwable).
static void logInfo(ModuleContext mc, Class claz, String method, String msg)
          Simplified proxy method for logInfo(ModuleContext, Class, String, Object[], Throwable), added for convenience.
static void logTrace(ModuleContext mc, Class claz, String method, Object[] msgPart, Throwable t)
          Provides a standard way for using container-specific loggers for logging trace messages via ModuleContext.logTrace(String, String, Throwable).
static void logTrace(ModuleContext mc, Class claz, String method, String msg)
          Simplified proxy method for logTrace(ModuleContext, Class, String, Object[], Throwable), added for convenience.
static void logWarn(ModuleContext mc, Class claz, String method, Object[] msgPart, Throwable t)
          Provides a standard way for using container-specific loggers for logging warn messages via ModuleContext.logWarn(String, String, Throwable).
static void logWarn(ModuleContext mc, Class claz, String method, String msg)
          Simplified proxy method for logWarn(ModuleContext, Class, String, Object[], Throwable), added for convenience.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogUtils

public LogUtils()
Method Detail

logDebug

public static void logDebug(ModuleContext mc,
                            Class claz,
                            String method,
                            Object[] msgPart,
                            Throwable t)
Provides a standard way for using container-specific loggers for logging debug messages via ModuleContext.logDebug(String, String, Throwable). The advantage compared to using ModuleContext.logDebug(String, String, Throwable) directly is twofold:
  1. here registered instances of LogListener are notified automatically, and
  2. the message string needed by ModuleContext.logDebug(String, String, Throwable) is built in a structured way by concatenating several different info (see the parameters as well as buildMsg(Object[])).

    Parameters:
    mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
    claz - The Java class that wants to generate the log message
    method - The name of the method in the above Java class that intends to generate the log message
    msgPart - An array of strings and other objects that should be concatenated using String.valueOf(Object) in order to construct the log message
    t - An optional Throwable object like an exception that might have caused the log request

logDebug

public static void logDebug(ModuleContext mc,
                            Class claz,
                            String method,
                            String msg)
Simplified proxy method for logDebug(ModuleContext, Class, String, Object[], Throwable), added for convenience.

Parameters:
mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
claz - The Java class that wants to generate the log message
method - The name of the method in the above Java class that intends to generate the log message
msg - The log message as a simple String

logError

public static void logError(ModuleContext mc,
                            Class claz,
                            String method,
                            Object[] msgPart,
                            Throwable t)
Provides a standard way for using container-specific loggers for logging error messages via ModuleContext.logError(String, String, Throwable). The advantage compared to using ModuleContext.logError(String, String, Throwable) directly is twofold:
  1. here registered instances of LogListener are notified automatically, and
  2. the message string needed by ModuleContext.logError(String, String, Throwable) is built in a structured way by concatenating several different info (see the parameters as well as buildMsg(Object[])).

    Parameters:
    mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
    claz - The Java class that wants to generate the log message
    method - The name of the method in the above Java class that intends to generate the log message
    msgPart - An array of strings and other objects that should be concatenated using String.valueOf(Object) in order to construct the log message
    t - An optional Throwable object like an exception that might have caused the log request

logError

public static void logError(ModuleContext mc,
                            Class claz,
                            String method,
                            String msg)
Simplified proxy method for logError(ModuleContext, Class, String, Object[], Throwable), added for convenience.

Parameters:
mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
claz - The Java class that wants to generate the log message
method - The name of the method in the above Java class that intends to generate the log message
msg - The log message as a simple String

logInfo

public static void logInfo(ModuleContext mc,
                           Class claz,
                           String method,
                           Object[] msgPart,
                           Throwable t)
Provides a standard way for using container-specific loggers for logging info messages via ModuleContext.logInfo(String, String, Throwable). The advantage compared to using ModuleContext.logInfo(String, String, Throwable) directly is twofold:
  1. here registered instances of LogListener are notified automatically, and
  2. the message string needed by ModuleContext.logInfo(String, String, Throwable) is built in a structured way by concatenating several different info (see the parameters as well as buildMsg(Object[])).

    Parameters:
    mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
    claz - The Java class that wants to generate the log message
    method - The name of the method in the above Java class that intends to generate the log message
    msgPart - An array of strings and other objects that should be concatenated using String.valueOf(Object) in order to construct the log message
    t - An optional Throwable object like an exception that might have caused the log request

logInfo

public static void logInfo(ModuleContext mc,
                           Class claz,
                           String method,
                           String msg)
Simplified proxy method for logInfo(ModuleContext, Class, String, Object[], Throwable), added for convenience.

Parameters:
mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
claz - The Java class that wants to generate the log message
method - The name of the method in the above Java class that intends to generate the log message
msg - The log message as a simple String

logWarn

public static void logWarn(ModuleContext mc,
                           Class claz,
                           String method,
                           Object[] msgPart,
                           Throwable t)
Provides a standard way for using container-specific loggers for logging warn messages via ModuleContext.logWarn(String, String, Throwable). The advantage compared to using ModuleContext.logWarn(String, String, Throwable) directly is twofold:
  1. here registered instances of LogListener are notified automatically, and
  2. the message string needed by ModuleContext.logWarn(String, String, Throwable) is built in a structured way by concatenating several different info (see the parameters as well as buildMsg(Object[])).

    Parameters:
    mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
    claz - The Java class that wants to generate the log message
    method - The name of the method in the above Java class that intends to generate the log message
    msgPart - An array of strings and other objects that should be concatenated using String.valueOf(Object) in order to construct the log message
    t - An optional Throwable object like an exception that might have caused the log request

logWarn

public static void logWarn(ModuleContext mc,
                           Class claz,
                           String method,
                           String msg)
Simplified proxy method for logWarn(ModuleContext, Class, String, Object[], Throwable), added for convenience.

Parameters:
mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
claz - The Java class that wants to generate the log message
method - The name of the method in the above Java class that intends to generate the log message
msg - The log message as a simple String

logTrace

public static void logTrace(ModuleContext mc,
                            Class claz,
                            String method,
                            Object[] msgPart,
                            Throwable t)
Provides a standard way for using container-specific loggers for logging trace messages via ModuleContext.logTrace(String, String, Throwable). The advantage compared to using ModuleContext.logTrace(String, String, Throwable) directly is twofold:
  1. here registered instances of LogListener are notified automatically, and
  2. the message string needed by ModuleContext.logTrace(String, String, Throwable) is built in a structured way by concatenating several different info (see the parameters as well as buildMsg(Object[])).

    Parameters:
    mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
    claz - The Java class that wants to generate the log message
    method - The name of the method in the above Java class that intends to generate the log message
    msgPart - An array of strings and other objects that should be concatenated using String.valueOf(Object) in order to construct the log message
    t - An optional Throwable object like an exception that might have caused the log request

logTrace

public static void logTrace(ModuleContext mc,
                            Class claz,
                            String method,
                            String msg)
Simplified proxy method for logTrace(ModuleContext, Class, String, Object[], Throwable), added for convenience.

Parameters:
mc - the ModuleContext needed for accessing the container-specific logger for the corresponding module
claz - The Java class that wants to generate the log message
method - The name of the method in the above Java class that intends to generate the log message
msg - The log message as a simple String


Copyright © 2014 universAAL Consortium. All Rights Reserved.