org.openmobileis.common.util.log
Class LogManager

java.lang.Object
  extended byorg.openmobileis.common.util.log.LogManager
Direct Known Subclasses:
FileLogManager, FileOpenCloseLogManager

public class LogManager
extends java.lang.Object

This class permits to manage log. LogManager is an abstract class to hide the underneath log. It can be mapped to Log4J or other log API. We provide default log for console and file log. Any other log manager can be plug. Default log id define with tree parameters : service : the service that log. defined by the class LogServices. priority : the log priority defined by the class LogPriorities. the log object. The toString method is call on the object except for exception where the printStackTrace methode is call. Some helper method is defined to faclitate the use of log that define default values for Service or priority. LogManager is initialized by calling the getInstance method. If null is provided, default console logging is set. All log are done using LogManager class.

 exemple :
   ....
  public void methodRed () {
    ....
    LogManager.traceInfo(0, "Log in methodRed");
    ....
    ....
    try {
    } catch (java.lang.OpenMSPException exec ) {
      LogManager.traceError(0, exec);
    }

  }

Since:
JDK1.1
Version:
1.0
Author:
P.Delrieu

Field Summary
protected static LogManager instance
          Static instance of LogManager
protected static java.util.HashMap logTable
           
protected  LogTracer tracer
           
 
Constructor Summary
protected LogManager()
           
protected LogManager(java.util.Properties props)
          The constructor is protected in order to use the class LogManager like a singleton.
 
Method Summary
static void attachLogTracerToPriority(int priority, LogTracer t)
          attache the specified logTracer to a priority.
static LogManager getInstance()
           This methods return the only LogManager instance.
 LogTracer getLogTracer()
           
static void registerLogManager(java.util.Properties props)
           
 void setLogTracer(LogTracer t)
           
 void trace(int service, int priority, java.lang.Object obj)
          Trace the Object with specified service and priority to the Log system.
static void trace(OpenMISException exp)
           
static void traceAlert(int service, java.lang.Object obj)
          Trace the Object in ALERT priority with specified service to the Log system.
static void traceCritique(int service, java.lang.Object obj)
          Trace the Object in CRITIQUE priority with specified service to the Log system.
static void traceDebug(int service, java.lang.Object obj)
          Trace the Object in DEBUG priority with specified service to the Log system.
static void traceEmergency(int service, java.lang.Object obj)
          Trace the Object in EMERGENCY priority with specified service to the Log system.
static void traceError(int service, java.lang.Object obj)
          Trace the Object in ERROR priority with specified service to the Log system.
static void traceInfo(int service, java.lang.Object obj)
          Trace the Object in INFO priority with specified service to the Log system.
static void traceNotice(int service, java.lang.Object obj)
          Trace the Object in NOTICE priority with specified service to the Log system.
static void traceUserSynchro(int service, java.lang.Object obj)
          Trace the Object in DEBUG priority with specified service to the Log system.
static void traceWarning(int service, java.lang.Object obj)
          Trace the Object in WARNING priority with specified service to the Log system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static LogManager instance
Static instance of LogManager


tracer

protected LogTracer tracer

logTable

protected static java.util.HashMap logTable
Constructor Detail

LogManager

protected LogManager(java.util.Properties props)
The constructor is protected in order to use the class LogManager like a singleton.


LogManager

protected LogManager()
Method Detail

attachLogTracerToPriority

public static void attachLogTracerToPriority(int priority,
                                             LogTracer t)
attache the specified logTracer to a priority. No attached priority use the default logTracer to trace. Attached priority will use the specified tracer to log.


getInstance

public static LogManager getInstance()
This methods return the only LogManager instance.

Returns:
the only instance

registerLogManager

public static void registerLogManager(java.util.Properties props)

trace

public static void trace(OpenMISException exp)

trace

public void trace(int service,
                  int priority,
                  java.lang.Object obj)
Trace the Object with specified service and priority to the Log system. If object is an exception the track is traced.


traceEmergency

public static void traceEmergency(int service,
                                  java.lang.Object obj)
Trace the Object in EMERGENCY priority with specified service to the Log system. If object is an exception the track is traced.


traceCritique

public static void traceCritique(int service,
                                 java.lang.Object obj)
Trace the Object in CRITIQUE priority with specified service to the Log system. If object is an exception the track is traced.


traceAlert

public static void traceAlert(int service,
                              java.lang.Object obj)
Trace the Object in ALERT priority with specified service to the Log system. If object is an exception the track is traced.


traceError

public static void traceError(int service,
                              java.lang.Object obj)
Trace the Object in ERROR priority with specified service to the Log system. If object is an exception the track is traced.


traceWarning

public static void traceWarning(int service,
                                java.lang.Object obj)
Trace the Object in WARNING priority with specified service to the Log system. If object is an exception the track is traced.


traceNotice

public static void traceNotice(int service,
                               java.lang.Object obj)
Trace the Object in NOTICE priority with specified service to the Log system. If object is an exception the track is traced.


traceInfo

public static void traceInfo(int service,
                             java.lang.Object obj)
Trace the Object in INFO priority with specified service to the Log system. If object is an exception the track is traced.


traceDebug

public static void traceDebug(int service,
                              java.lang.Object obj)
Trace the Object in DEBUG priority with specified service to the Log system. If object is an exception the track is traced.


traceUserSynchro

public static void traceUserSynchro(int service,
                                    java.lang.Object obj)
Trace the Object in DEBUG priority with specified service to the Log system. If object is an exception the track is traced.


getLogTracer

public LogTracer getLogTracer()

setLogTracer

public void setLogTracer(LogTracer t)


Copyright 2005 e-Care. All Rights Reserved.