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

Quick Search    Search Deep

hk.hku.cecid.phoenix.common.util
Class Logger  view Logger download Logger.java

java.lang.Object
  extended byhk.hku.cecid.phoenix.common.util.Logger
Direct Known Subclasses:
JDKLogger, Log4JLogger

public abstract class Logger
extends java.lang.Object

This is a wrapper class for logging. This class shields the complexity for using JDK1.3 or JDK1.4, using log4j or JDK Logging API. All configuration information are read from properties file.

Version:
$Revision: 1.15 $

Field Summary
protected static java.util.HashMap cache
          Cached logger
protected  java.lang.String className
          The class name for logging in funcIn/fucnOut.
protected static java.lang.String DEF_LOGFILE
          Default name of log file
protected static java.lang.String fileSep
          Variable holding the file separator charactor
protected static java.lang.String homeDir
          Variable holding the home directory of the user
protected static int level
          Variable for the log level
protected static java.lang.String logFileName
          Variable for full path of the log file
protected static int MIN_ROLLING_SIZE
          Minumum limit size for rolling log files
protected static int size
          Variable for the maximum log file size (rotating log)
protected static boolean useJDK
          Variable controlling whether to use JDK 1.4 Logging or not
 
Constructor Summary
Logger()
           
 
Method Summary
abstract  void debug(java.lang.String mesg)
          Does a level 0 logging.
abstract  void error(java.lang.String mesg)
          Does a level 3 logging.
 void funcIn(java.lang.String funcName)
          Does a level 0 logging on function in/out.
 void funcOut(java.lang.String funcName)
          Does a level 0 logging on function in/out.
static Logger getLogger(java.lang.String name)
          Gets a logger instance by a specified name as key.
abstract  void info(java.lang.String mesg)
          Does a level 1 logging.
protected  void setLoggingClassName(java.lang.String name)
           
static void setLoggingProperty(Property prop)
          Sets logging property by providing a Property object.
static void setLoggingProperty(java.lang.String useLogger, java.lang.String logPath, java.lang.String logFile, java.lang.String logLevel, java.lang.String logSize)
          Sets logging property by providing individual property values.
abstract  void warn(java.lang.String mesg)
          Does a level 2 logging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEF_LOGFILE

protected static final java.lang.String DEF_LOGFILE
Default name of log file

See Also:
Constant Field Values

MIN_ROLLING_SIZE

protected static final int MIN_ROLLING_SIZE
Minumum limit size for rolling log files

See Also:
Constant Field Values

useJDK

protected static boolean useJDK
Variable controlling whether to use JDK 1.4 Logging or not


logFileName

protected static java.lang.String logFileName
Variable for full path of the log file


level

protected static int level
Variable for the log level


size

protected static int size
Variable for the maximum log file size (rotating log)


homeDir

protected static java.lang.String homeDir
Variable holding the home directory of the user


fileSep

protected static java.lang.String fileSep
Variable holding the file separator charactor


cache

protected static java.util.HashMap cache
Cached logger


className

protected java.lang.String className
The class name for logging in funcIn/fucnOut. This is to be the same as the name for use in getLogger().

Constructor Detail

Logger

public Logger()
Method Detail

debug

public abstract void debug(java.lang.String mesg)
Does a level 0 logging. Equivalent to debug() in Log4J.


info

public abstract void info(java.lang.String mesg)
Does a level 1 logging. Equivalent to info() in Log4J.


warn

public abstract void warn(java.lang.String mesg)
Does a level 2 logging. Equivalent to warn() in Log4J.


error

public abstract void error(java.lang.String mesg)
Does a level 3 logging. Equivalent to error() in Log4J.


funcIn

public void funcIn(java.lang.String funcName)
Does a level 0 logging on function in/out.


funcOut

public void funcOut(java.lang.String funcName)
Does a level 0 logging on function in/out.


setLoggingClassName

protected void setLoggingClassName(java.lang.String name)

setLoggingProperty

public static void setLoggingProperty(Property prop)
Sets logging property by providing a Property object. The change of setting will affect the log objects created afterwards. All log objects created beforehand will not be affected.


setLoggingProperty

public static void setLoggingProperty(java.lang.String useLogger,
                                      java.lang.String logPath,
                                      java.lang.String logFile,
                                      java.lang.String logLevel,
                                      java.lang.String logSize)
Sets logging property by providing individual property values. The change of setting will affect the log objects created afterwards. All log objects created beforehand will not be affected.


getLogger

public static Logger getLogger(java.lang.String name)
Gets a logger instance by a specified name as key. Internally, passing the same name as parameters will always get the same Logger object. Whether the logger instance is a JDK-based, or Log4J-based in automatically determined.