de.fhg.igd.logging
Interface Logger

All Known Subinterfaces:
AgentLoggerContext
All Known Implementing Classes:
AgentLoggerContextImpl, LoggerImpl, LoggerProxy

public interface Logger

This is the main logging interface.

It defines a set of convenience methods for logging at a specific LogLevel, for method entries and exits (either regular or by throwing an exception), as well as for caught exceptions.

Furthermore, usage at a specific log level may be checked at runtime by means of isEnabled(LogLevel).

Instances are available via LoggerFactory.getLogger() and LoggerFactory.getLogger(String).

Version:
"$Id: Logger.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Matthias Pressfreund

Method Summary
 void caught(LogLevel level, String msg, Throwable thrown)
          This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then caught(Throwable).
 void caught(Throwable thrown)
          This method is supposed to be used for logging the catching of a Throwable (and subclasses).
 void debug(String msg)
          Creates a log entry on LogLevel.DEBUG.
 void entering()
          This method is supposed to be used for logging the entry of a parameterless method.
 void entering(Object[] params)
          This method is supposed to be used for logging the entry of a method with a set of parameters.
 void error(String msg)
          Creates a log entry on LogLevel.ERROR.
 void exiting()
          This method is supposed to be used for logging the exit of a method without return value.
 void exiting(Object result)
          This method is supposed to be used for logging the exit of a method with a return value.
 void fatal(String msg)
          Creates a log entry on LogLevel.FATAL.
 void info(String msg)
          Creates a log entry on LogLevel.INFO.
 boolean isEnabled(LogLevel level)
          Find out if logging would be performed at the given log level.
 void log(LogLevel level, String msg)
          This is the generic log method to be used for creating a log entry on the specified log level.
 void severe(String msg)
          Creates a log entry on LogLevel.SEVERE.
 void throwing(LogLevel level, String msg, Throwable thrown)
          This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then throwing(Throwable).
 void throwing(Throwable thrown)
          This method is supposed to be used for logging the creation and method exit by a Throwable (and subclasses).
 void trace(String msg)
          Creates a log entry on LogLevel.TRACE.
 void warning(String msg)
          Creates a log entry on LogLevel.WARNING.
 

Method Detail

log

public void log(LogLevel level,
                String msg)
This is the generic log method to be used for creating a log entry on the specified log level.

Parameters:
level - The log level to be used for creating the log entry
msg - The message to be written into the log entry

trace

public void trace(String msg)
Creates a log entry on LogLevel.TRACE.

Parameters:
msg - The message to be written into the log entry

debug

public void debug(String msg)
Creates a log entry on LogLevel.DEBUG.

Parameters:
msg - The message to be written into the log entry

info

public void info(String msg)
Creates a log entry on LogLevel.INFO.

Parameters:
msg - The message to be written into the log entry

warning

public void warning(String msg)
Creates a log entry on LogLevel.WARNING.

Parameters:
msg - The message to be written into the log entry

error

public void error(String msg)
Creates a log entry on LogLevel.ERROR.

Parameters:
msg - The message to be written into the log entry

severe

public void severe(String msg)
Creates a log entry on LogLevel.SEVERE.

Parameters:
msg - The message to be written into the log entry

fatal

public void fatal(String msg)
Creates a log entry on LogLevel.FATAL.

Parameters:
msg - The message to be written into the log entry

entering

public void entering()
This method is supposed to be used for logging the entry of a parameterless method. Hereby, the used log level will be LogLevel.TRACE.


entering

public void entering(Object[] params)
This method is supposed to be used for logging the entry of a method with a set of parameters. Hereby, the used log level will be LogLevel.TRACE.

Parameters:
params - The method parameters, for printing the toString() method will be called on each object

exiting

public void exiting()
This method is supposed to be used for logging the exit of a method without return value. Hereby, the used log level will be LogLevel.TRACE.


exiting

public void exiting(Object result)
This method is supposed to be used for logging the exit of a method with a return value. Hereby, the used log level will be LogLevel.TRACE.

Parameters:
result - The return value, for printing the toString() method will be called

throwing

public void throwing(Throwable thrown)
This method is supposed to be used for logging the creation and method exit by a Throwable (and subclasses). Hereby, the used log level will be LogLevel.TRACE.

Parameters:
thrown - The exception that will be thrown

throwing

public void throwing(LogLevel level,
                     String msg,
                     Throwable thrown)
This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then throwing(Throwable).

Parameters:
level - The log level to be used for creating the log entry
msg - The message to be written into the log entry
thrown - The exception that will be thrown

caught

public void caught(Throwable thrown)
This method is supposed to be used for logging the catching of a Throwable (and subclasses). Hereby, the used log level will be LogLevel.TRACE.

Parameters:
thrown - The exception that has been caught

caught

public void caught(LogLevel level,
                   String msg,
                   Throwable thrown)
This method implicitely calls log(de.fhg.igd.logging.LogLevel, java.lang.String) first, then caught(Throwable).

Parameters:
level - The log level to be used for creating the log entry
msg - The message to be written into the log entry
thrown - The exception that has been caught

isEnabled

public boolean isEnabled(LogLevel level)
Find out if logging would be performed at the given log level.

This method might be useful in cases of costly log message creation which should be performed only if really needed.

Parameters:
level - The log level to check for
Returns:
whether or not logging would be performed at the given log level


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.