org.af.commons.logging
Class LoggingSystem

java.lang.Object
  extended by org.af.commons.logging.LoggingSystem

public class LoggingSystem
extends Object

Class encapsulates the whole logging process. This is mainly the log4J setup and the potential handling / redirection of the stdout and stderr streams. But it a also provides an ApplicationLog object which contains the log4J events for convenient access and can be specialised to contain application specific logging info. The class is singelton but can be extended by inheritance. For that reason the only creation of an instance is allowed thru the init method an that only once.


Method Summary
static boolean alreadyInitiated()
           
 ApplicationLog getApplicationLog()
           
static LoggingSystem getInstance()
           
static void init(String log4JpropsResourceName, boolean redirectSystemStreams, boolean printToConsole, ApplicationLog appLog)
          Call this to setup the singelton instance at the beginning.
 DetailsPanel makeDetailsPanel()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

alreadyInitiated

public static boolean alreadyInitiated()

init

public static void init(String log4JpropsResourceName,
                        boolean redirectSystemStreams,
                        boolean printToConsole,
                        ApplicationLog appLog)
Call this to setup the singelton instance at the beginning. Only one call allowed.

Parameters:
log4JpropsResourceName - Name of log4J properties file. Must be on classpath
redirectSystemStreams - should the stdout/err streams be redirected to the logger?
printToConsole - should the stdout/err streams be printed to the console?
appLog - contains all logging info
Throws:
RuntimeException - when init was already called before

getInstance

public static LoggingSystem getInstance()
Returns:
Singleton instance.

getApplicationLog

public ApplicationLog getApplicationLog()
Returns:
ApplicationLog object to access logging info

makeDetailsPanel

public DetailsPanel makeDetailsPanel()
Returns:
a JPanel containing the logging infos for a GUI based app