Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.openolas.util
Class Logger  view Logger download Logger.java

java.lang.Object
  extended byorg.openolas.util.Logger

public final class Logger
extends java.lang.Object

This class implements the Facade pattern for a logging system. It provides a unified interface to a set of interfaces to a subsystem, by defining a higher-level interface that makes the subsystem (in this case, the logging subsystem) easier to use. Requests made to the Logger class (the Facade) are forwarded to the actual logging library. Doing this allows us to decouple the code base at large from a specific logging facility.

Use the factory method newInstance(Class) 55 to get a new Logger instance.

At this time Jakarta's Log4J has been chosen to be the actual logging library. We may want to later switch to the official Sun logging package java.util.logging, still in development at the time of this writing.

I declared this class final because I don't see any good reason why anyone would want to extend it. If you need more functionality than this class provides, either use Log4J directly or modify the Facade itself to include that functionality.


Field Summary
private  org.apache.log4j.Category cat
           
private static java.lang.String classname
           
private static boolean configured
           
private static java.lang.String DEFAULT_CONFIG_FILE
          The name of the default configuration file for this object.
 
Constructor Summary
private Logger(org.apache.log4j.Category cat)
          Private constructor prevents instantiation.
 
Method Summary
static void configure()
          This initializer configures the logging sub-system with the DEFAULT_CONFIG_FILE 55 .
static void configure(java.lang.String configFile)
          Configure the logging sub-system from the given file.
static void configure(java.net.URL u)
          Configure the logging sub-system from the given URL.
 void debug(java.lang.Object message)
           
 void debug(java.lang.Object message, java.lang.Throwable t)
           
 void error(java.lang.Object message)
           
 void error(java.lang.Object message, java.lang.Throwable t)
           
 void fatal(java.lang.Object message)
           
 void fatal(java.lang.Object message, java.lang.Throwable t)
           
 void info(java.lang.Object message)
           
 void info(java.lang.Object message, java.lang.Throwable t)
           
static Logger newInstance(java.lang.Class c)
          Factory method to create a Logger object instance, used for logging.
static Logger newInstance(java.lang.String s)
          Factory method to create a Logger object instance, used for logging.
 void warn(java.lang.Object message)
           
 void warn(java.lang.Object 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

DEFAULT_CONFIG_FILE

private static final java.lang.String DEFAULT_CONFIG_FILE
The name of the default configuration file for this object. It is looked up in this classloader's resources using Class.getResource 55 .

See Also:
Constant Field Values

configured

private static boolean configured

classname

private static final java.lang.String classname

cat

private final org.apache.log4j.Category cat
Constructor Detail

Logger

private Logger(org.apache.log4j.Category cat)
Private constructor prevents instantiation.

Method Detail

newInstance

public static Logger newInstance(java.lang.Class c)
Factory method to create a Logger object instance, used for logging.


newInstance

public static Logger newInstance(java.lang.String s)
Factory method to create a Logger object instance, used for logging. Always prefer newInstance(Class) 55 over this method. Use this method only when no class is available in the context (e.g. inside a JSP).


configure

public static void configure()
This initializer configures the logging sub-system with the DEFAULT_CONFIG_FILE 55 .


configure

public static void configure(java.lang.String configFile)
Configure the logging sub-system from the given file. The file is looked up in the same directory as the class file.


configure

public static void configure(java.net.URL u)
Configure the logging sub-system from the given URL. It is advised you use configure(String) 55 instead.


debug

public void debug(java.lang.Object message)

info

public void info(java.lang.Object message)

warn

public void warn(java.lang.Object message)

error

public void error(java.lang.Object message)

fatal

public void fatal(java.lang.Object message)

debug

public void debug(java.lang.Object message,
                  java.lang.Throwable t)

info

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

warn

public void warn(java.lang.Object message,
                 java.lang.Throwable t)

error

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

fatal

public void fatal(java.lang.Object message,
                  java.lang.Throwable t)