de.fhg.igd.logging
Class LoggerProxy

java.lang.Object
  extended byde.fhg.igd.logging.LoggerProxy
All Implemented Interfaces:
Logger

public class LoggerProxy
extends Object
implements Logger

This is a proxy class used by the LoggerFactory for wrapping LoggerImpl instances in order to be able to exchange loggers easily in case of configuration change requests.

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

Field Summary
protected  String name_
          The name of this proxy
(package private)  LoggerImpl target_
          The target Logger implementation
 
Constructor Summary
(package private) LoggerProxy(Class wclazz, String name, String group)
          Hidden construction.
 
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).
(package private)  LoggerImpl createBetterTarget()
          In case there is a better matching target for this proxy, request and return its instance.
 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.
 boolean equals(Object obj)
           
 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 finalize()
          This method will be called by the garbage collector as soon as this proxy is no longer referenced.
 String getName()
           
(package private)  LoggerImpl getTarget()
           
 int hashCode()
           
 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).
 String toString()
           
 void trace(String msg)
          Creates a log entry on LogLevel.TRACE.
(package private)  void updateTarget(LoggerImpl target)
          Exchange the target of this proxy.
 void warning(String msg)
          Creates a log entry on LogLevel.WARNING.
 
Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name_

protected String name_
The name of this proxy


target_

LoggerImpl target_
The target Logger implementation

Constructor Detail

LoggerProxy

LoggerProxy(Class wclazz,
            String name,
            String group)
Hidden construction.

Parameters:
wclazz - The Wrapper implementation class to be used
name - The name of this proxy
group - The group of this proxy and the target logger
Method Detail

getName

public String getName()

getTarget

LoggerImpl getTarget()

createBetterTarget

LoggerImpl createBetterTarget()
In case there is a better matching target for this proxy, request and return its instance. If the current target is the best match already, return null.

Returns:
A better matching target for this proxy or null if there is no better match available

updateTarget

void updateTarget(LoggerImpl target)
Exchange the target of this proxy.

Parameters:
target - The new target for this proxy

log

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

Specified by:
log in interface Logger
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)
Description copied from interface: Logger
Creates a log entry on LogLevel.TRACE.

Specified by:
trace in interface Logger
Parameters:
msg - The message to be written into the log entry

debug

public void debug(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.DEBUG.

Specified by:
debug in interface Logger
Parameters:
msg - The message to be written into the log entry

info

public void info(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.INFO.

Specified by:
info in interface Logger
Parameters:
msg - The message to be written into the log entry

warning

public void warning(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.WARNING.

Specified by:
warning in interface Logger
Parameters:
msg - The message to be written into the log entry

error

public void error(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.ERROR.

Specified by:
error in interface Logger
Parameters:
msg - The message to be written into the log entry

severe

public void severe(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.SEVERE.

Specified by:
severe in interface Logger
Parameters:
msg - The message to be written into the log entry

fatal

public void fatal(String msg)
Description copied from interface: Logger
Creates a log entry on LogLevel.FATAL.

Specified by:
fatal in interface Logger
Parameters:
msg - The message to be written into the log entry

entering

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

Specified by:
entering in interface Logger

entering

public void entering(Object[] params)
Description copied from interface: Logger
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.

Specified by:
entering in interface Logger
Parameters:
params - The method parameters, for printing the toString() method will be called on each object

exiting

public void exiting()
Description copied from interface: Logger
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.

Specified by:
exiting in interface Logger

exiting

public void exiting(Object result)
Description copied from interface: Logger
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.

Specified by:
exiting in interface Logger
Parameters:
result - The return value, for printing the toString() method will be called

throwing

public void throwing(Throwable thrown)
Description copied from interface: Logger
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.

Specified by:
throwing in interface Logger
Parameters:
thrown - The exception that will be thrown

throwing

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

Specified by:
throwing in interface Logger
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)
Description copied from interface: Logger
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.

Specified by:
caught in interface Logger
Parameters:
thrown - The exception that has been caught

caught

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

Specified by:
caught in interface Logger
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)
Description copied from interface: Logger
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.

Specified by:
isEnabled in interface Logger
Parameters:
level - The log level to check for
Returns:
whether or not logging would be performed at the given log level

finalize

public void finalize()
This method will be called by the garbage collector as soon as this proxy is no longer referenced.


equals

public boolean equals(Object obj)

hashCode

public int hashCode()

toString

public String toString()


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.