org.eclipse.datatools.connectivity.oda.util.logging
Class LogManager

java.lang.Object
  extended byorg.eclipse.datatools.connectivity.oda.util.logging.LogManager

public class LogManager
extends java.lang.Object

LogManager is a static class that maintains a set of named Loggers. It provides the interface to create named Loggers and to retrieve the loggers for logging purposes.


Method Summary
static Logger createLogger(java.lang.String loggerName, int logLevel, java.lang.String logDirectory, java.lang.String logPrefix, java.lang.String formatterClassName)
          Creates a named Logger with the necessary log configuration information.
static Logger getLogger(java.lang.String loggerName)
          Gets a previously created Logger by name.
static Logger getLogger(java.lang.String loggerName, int logLevel, java.lang.String logDirectory, java.lang.String logPrefix, java.lang.String formatterClassName)
          Creates a named Logger with the specified log configuration information, if the named Logger doesn't already exist.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createLogger

public static Logger createLogger(java.lang.String loggerName,
                                  int logLevel,
                                  java.lang.String logDirectory,
                                  java.lang.String logPrefix,
                                  java.lang.String formatterClassName)
Creates a named Logger with the necessary log configuration information. The specified logger name should be specific to the application using the logging framework to prevent name collision in the logger namespace, since multiple loggers cannot be created with the same logger name.

Parameters:
loggerName - the name of the logger to be created.
logLevel - the logger log level.
logDirectory - the required directory to store the logs.
logPrefix - the required file name prefix of the log file name; the format will be <logPrefix>-YYMMDD-hhmmss.log.
formatterClassName - a LogFormatter class name; if this is null or empty, the default LogFormatter will be used. The customized log formatter must inherit from org.eclipse.datatools.connectivity.oda.logging.LogFormatter and implements the format() method.
Returns:
the constructed named Logger.
Throws:
java.lang.IllegalArgumentException - if logger with the same name already exists.

getLogger

public static Logger getLogger(java.lang.String loggerName,
                               int logLevel,
                               java.lang.String logDirectory,
                               java.lang.String logPrefix,
                               java.lang.String formatterClassName)
Creates a named Logger with the specified log configuration information, if the named Logger doesn't already exist. If the named Logger already exists, then it will be updated the specified log configuration. If the specified log level or the formatter class is different, then the new values will be set while maintaining the same log file. If either the log directory or the log prefix has changed, then a new log file will be created.

Parameters:
loggerName - the name of the logger to be created or updated.
logLevel - the logger log level.
logDirectory - the required directory to store the logs.
logPrefix - the required file name prefix of the log file name; the format will be <logPrefix>-YYMMDD-hhmmss.log.
formatterClassName - a LogFormatter class name; if this is null or empty, the default LogFormatter will be used. The customized log formatter must inherit from org.eclipse.datatools.connectivity.oda.logging.LogFormatter and implements the format() method.
Returns:
the constructed or updated named Logger.

getLogger

public static Logger getLogger(java.lang.String loggerName)
Gets a previously created Logger by name. The specified name must be the same name used in the createLogger() method.

Parameters:
loggerName - the logger's name.
Returns:
the Logger associated with the name; null if no Logger is associated with the specified name.


Copyright © 2005 Actuate Corp. All rights reserved.