iaik.tc.utils.logging
Class Log

java.lang.Object
  extended by iaik.tc.utils.logging.Log

public class Log
extends java.lang.Object

This class provides logging functionality for the whole project. By default, this class has one console writer. New writers can be added and removed at runtime. It is also possible to read the configuration for logging from a string-value (which can be defined in a configuration-file).


Constructor Summary
Log()
           
 
Method Summary
static void addOutStream(LogGenericOutputHandler handler)
          Add an output handler to the list of writers
static void appendEclipseMarkers(boolean append)
          This method allows users to specify if markers for Eclipse should be appended to log messages.
static void debug(java.lang.String msg)
          Log a debug message
static void err(java.lang.Exception e)
          Log an error-message.
static void err(java.lang.String msg)
          Log an error-message.
static void err(java.lang.String msg, java.lang.Exception e)
          Log an error-message.
static void flushLogLevelSpecific()
          This method is used to reset all class-specific logging configurations.
static void flushLogLevelSpecific(java.lang.Class classinfo)
          This method is used to delete the logging setting for a specific class.
static short getLogLevel()
          This method allows users to query the current log level.
static void info(java.lang.String msg)
          Log an informative message
static void logMsg(short level, java.lang.String msg)
          This method writes the log-message to all registered writers along with additional information like the current system-time, the calling method, the name of the calling class and the line number.
static void readConfig(java.lang.String config)
          Read the configuration of the Logging-class from the given string.
static void setLogLevel(java.lang.Class classinfo, short level)
          This method allows users to modify the current log level for a specific class.
static void setLogLevel(short level)
          This method allows users to modify the current log level.
static void warn(java.lang.String msg)
          Log a warning message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log

public Log()
Method Detail

readConfig

public static void readConfig(java.lang.String config)
Read the configuration of the Logging-class from the given string. The string contains a list of writers separated by semicolons. Possible writers are:
                        stdout:
                                write logging-output to the console
                        file:
                                write logging-output to a file. The filename is given after a colon. 
                                Example:  file:/tmp/log.txt
                        none:
                                null-writer. does not printout logging output
 
The method not only reads the provided configuration but also sets up the output streams accordingly.

Parameters:
config -

setLogLevel

public static void setLogLevel(short level)
This method allows users to modify the current log level.


getLogLevel

public static short getLogLevel()
This method allows users to query the current log level.

Returns:
current log level

setLogLevel

public static void setLogLevel(java.lang.Class classinfo,
                               short level)
This method allows users to modify the current log level for a specific class.


appendEclipseMarkers

public static void appendEclipseMarkers(boolean append)
This method allows users to specify if markers for Eclipse should be appended to log messages. These markers are parsed by Eclipse and allow users to simply jump to the line in the source where the log messages was generated.


flushLogLevelSpecific

public static void flushLogLevelSpecific()
This method is used to reset all class-specific logging configurations.


flushLogLevelSpecific

public static void flushLogLevelSpecific(java.lang.Class classinfo)
This method is used to delete the logging setting for a specific class.


addOutStream

public static void addOutStream(LogGenericOutputHandler handler)
Add an output handler to the list of writers

Parameters:
handler - new output handler for writing logging output

logMsg

public static void logMsg(short level,
                          java.lang.String msg)
This method writes the log-message to all registered writers along with additional information like the current system-time, the calling method, the name of the calling class and the line number.

Parameters:
level - the log level (as defined in the LogLevels class)
msg - the log-message itself

err

public static void err(java.lang.String msg)
Log an error-message.

Parameters:
msg - message to log

err

public static void err(java.lang.Exception e)
Log an error-message. This usually happens when dealing with an unintended exception

Parameters:
e - reference to the exception to log

err

public static void err(java.lang.String msg,
                       java.lang.Exception e)
Log an error-message. This usually happens when dealing with an unintended exception

Parameters:
e - reference to the exception to log
msg - message to log

warn

public static void warn(java.lang.String msg)
Log a warning message.

Parameters:
msg - message to log

info

public static void info(java.lang.String msg)
Log an informative message

Parameters:
msg - message to log

debug

public static void debug(java.lang.String msg)
Log a debug message

Parameters:
msg - message to log