de.infinityloop.util.log
Class LoggerProxy

java.lang.Object
  extended by de.infinityloop.util.log.LoggerProxy

public class LoggerProxy
extends java.lang.Object

This class is a proxy to logging and collecting error messages in memory. Useful when we want to switch to some different logging subsystem in the future.

Author:
chris

Field Summary
static boolean debugLogging
          When this constant is set to true, the logging system issues debug info to stdout.
 
Constructor Summary
protected LoggerProxy(NotificationCollector coll, LoggerConfiguration lc, LoggerDelegate deleg)
          Default constructor.
 
Method Summary
 void config(java.lang.String message)
           
static void configureLogging()
          The basic configuration method.
static void configureLogging(java.util.Properties props)
          Configure logging based on a Properties object (for example as used by Log4j).
 void debug(long flags, int code, java.lang.Object[] params)
           
 void debug(long flags, int code, java.lang.Object[] params, java.lang.Throwable t)
           
 void debug(long flags, java.lang.String message)
           
 void debug(long flags, java.lang.String message, java.lang.Throwable t)
           
static java.lang.String determineDefaultImplementation()
          Tries to determine the best default implementation.
 void entering(java.lang.String message)
           
 void error(int code, java.lang.Object[] params)
           
 void error(int code, java.lang.Object[] params, java.lang.Throwable t)
           
 void error(int code, java.lang.String message)
           
 void error(int code, java.lang.String message, java.lang.Throwable t)
           
 void error(java.lang.String message)
           
 void error(java.lang.String message, java.lang.Throwable t)
           
 void exiting(java.lang.String message)
           
 void fatal(int code, java.lang.Object[] params)
           
 void fatal(int code, java.lang.Object[] params, java.lang.Throwable t)
           
 void fatal(int code, java.lang.String message)
           
 void fatal(int code, java.lang.String message, java.lang.Throwable t)
           
 void fatal(java.lang.String message)
           
 void fine(java.lang.String message)
           
 void fine(java.lang.String message, java.lang.Throwable t)
           
 void finer(java.lang.String message)
           
 void finer(java.lang.String message, java.lang.Throwable t)
           
 void finest(java.lang.String message)
           
 void finest(java.lang.String message, java.lang.Throwable t)
           
 NotificationCollector getCollector()
          Retrieves this Logger's notification collector
 long getDebugMask()
           
 LoggerDelegate getDelegate()
          Retrieve this logger's delegate.
static java.lang.String getImplementation()
          Gets the implementation for logging as fully qualified class name.
static LoggerProxy getLogger(java.lang.Class c)
          Logger factory by class
static LoggerProxy getLogger(java.lang.Class c, NotificationCollector coll, LoggerConfiguration con)
           
static LoggerProxy getLogger(java.lang.String name)
          Logger factory by name
static LoggerProxy getLogger(java.lang.String name, NotificationCollector coll)
           
 void info(int code, java.lang.Object[] params)
           
 void info(int code, java.lang.Object[] params, java.lang.Throwable t)
           
 void info(java.lang.String message)
           
 void info(java.lang.String message, java.lang.Throwable t)
           
 boolean isDebugEnabled()
           
static void ldebug(java.lang.String message)
          Debugging the logging system.
 void setCollector(NotificationCollector c)
          Sets a new notification collector object for this ld proxy.
 void setDebugMask(long mask)
           
static void setImplementation(java.lang.String classname)
          Sets the implementation for logging to the respective class.
 void setLevel(int lev)
           
 void severe(int code, java.lang.String message)
           
 void severe(int code, java.lang.String message, java.lang.Throwable t)
           
 void warn(int code, java.lang.Object[] params)
           
 void warn(int code, java.lang.Object[] params, java.lang.Throwable t)
           
 void warn(int code, java.lang.String message)
           
 void warn(int code, java.lang.String message, java.lang.Throwable t)
           
 void warn(java.lang.String message)
           
 void warning(int code, java.lang.String message)
           
 void warning(int code, java.lang.String message, java.lang.Throwable t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugLogging

public static final boolean debugLogging
When this constant is set to true, the logging system issues debug info to stdout.

Constructor Detail

LoggerProxy

protected LoggerProxy(NotificationCollector coll,
                      LoggerConfiguration lc,
                      LoggerDelegate deleg)
Default constructor.

Method Detail

determineDefaultImplementation

public static java.lang.String determineDefaultImplementation()
Tries to determine the best default implementation. This is: - log4j 1.2.x - log4j 1.1.x - Java 1.4 logging (not yet implemented) - Console logging (System.out, System.err)

Returns:
the fully qualified name of the class to use

configureLogging

public static void configureLogging()
The basic configuration method. Sets up logging in some default way using a static method of the determined delegate class.


configureLogging

public static void configureLogging(java.util.Properties props)
Configure logging based on a Properties object (for example as used by Log4j).

Parameters:
props - the Properties object containing the configuration parameters

setImplementation

public static void setImplementation(java.lang.String classname)
Sets the implementation for logging to the respective class. This is a global option and takes effect for all subsequent instantiations of logging objects. Existing loggers do not change!

Parameters:
classname -

getImplementation

public static java.lang.String getImplementation()
Gets the implementation for logging as fully qualified class name.


getLogger

public static LoggerProxy getLogger(java.lang.String name)
Logger factory by name

Parameters:
name - the name of the Logger
Returns:
a wrapped log4j Logger

getLogger

public static LoggerProxy getLogger(java.lang.String name,
                                    NotificationCollector coll)

getLogger

public static LoggerProxy getLogger(java.lang.Class c)
Logger factory by class

Parameters:
c - the Class object
Returns:
a wrapped log4 Logger

getLogger

public static LoggerProxy getLogger(java.lang.Class c,
                                    NotificationCollector coll,
                                    LoggerConfiguration con)

getCollector

public NotificationCollector getCollector()
Retrieves this Logger's notification collector

Returns:
the NotificationCollector object

setCollector

public void setCollector(NotificationCollector c)
Sets a new notification collector object for this ld proxy.

Parameters:
c - the NotificationCollector to set

getDelegate

public LoggerDelegate getDelegate()
Retrieve this logger's delegate.

Returns:
the delegate

config

public void config(java.lang.String message)

entering

public void entering(java.lang.String message)

exiting

public void exiting(java.lang.String message)

fine

public void fine(java.lang.String message)

fine

public void fine(java.lang.String message,
                 java.lang.Throwable t)

finer

public void finer(java.lang.String message)

finer

public void finer(java.lang.String message,
                  java.lang.Throwable t)

finest

public void finest(java.lang.String message)

finest

public void finest(java.lang.String message,
                   java.lang.Throwable t)

warning

public void warning(int code,
                    java.lang.String message)

warning

public void warning(int code,
                    java.lang.String message,
                    java.lang.Throwable t)

severe

public void severe(int code,
                   java.lang.String message)

severe

public void severe(int code,
                   java.lang.String message,
                   java.lang.Throwable t)

setLevel

public void setLevel(int lev)

setDebugMask

public void setDebugMask(long mask)

getDebugMask

public long getDebugMask()

isDebugEnabled

public boolean isDebugEnabled()

debug

public void debug(long flags,
                  java.lang.String message)

debug

public void debug(long flags,
                  java.lang.String message,
                  java.lang.Throwable t)

debug

public void debug(long flags,
                  int code,
                  java.lang.Object[] params)

debug

public void debug(long flags,
                  int code,
                  java.lang.Object[] params,
                  java.lang.Throwable t)

info

public void info(java.lang.String message)

info

public void info(java.lang.String message,
                 java.lang.Throwable t)

info

public void info(int code,
                 java.lang.Object[] params)

info

public void info(int code,
                 java.lang.Object[] params,
                 java.lang.Throwable t)

warn

public void warn(java.lang.String message)

warn

public void warn(int code,
                 java.lang.String message)

warn

public void warn(int code,
                 java.lang.String message,
                 java.lang.Throwable t)

warn

public void warn(int code,
                 java.lang.Object[] params)

warn

public void warn(int code,
                 java.lang.Object[] params,
                 java.lang.Throwable t)

error

public void error(java.lang.String message)

error

public void error(java.lang.String message,
                  java.lang.Throwable t)

error

public void error(int code,
                  java.lang.String message)

error

public void error(int code,
                  java.lang.String message,
                  java.lang.Throwable t)

error

public void error(int code,
                  java.lang.Object[] params)

error

public void error(int code,
                  java.lang.Object[] params,
                  java.lang.Throwable t)

fatal

public void fatal(java.lang.String message)

fatal

public void fatal(int code,
                  java.lang.String message)

fatal

public void fatal(int code,
                  java.lang.String message,
                  java.lang.Throwable t)

fatal

public void fatal(int code,
                  java.lang.Object[] params)

fatal

public void fatal(int code,
                  java.lang.Object[] params,
                  java.lang.Throwable t)

ldebug

public static final void ldebug(java.lang.String message)
Debugging the logging system.

Parameters:
message - the message to send to System.out