WebLogic Integration


com.bea.logging
Class LogManager

java.lang.Object
  |
  +--com.bea.logging.LogManager

public class LogManager
extends java.lang.Object

A factory for ILogger instances. This class hides the actual logging implemenation used by the framework.

Author:
Copyright © 2000, 2001 BEA Systems, Inc. All Rights Reserved.

Constructor Summary
LogManager()
           
 
Method Summary
static LogContext configure(java.lang.String strLogConfigFile, java.lang.String strRootLogContext, java.lang.String strMessageBundleBase, java.util.Locale locale, java.lang.ClassLoader classLoader)
          Configures the underlying logging system with the parameters specified.
static LogContext getLogContext(java.lang.Thread t)
          Retrieves a log context for a thread.
static ILogger getLogger()
          A convenience method to retrieve a logger for the current running thread.
static ILogger getLogger(LogContext context)
           
static java.util.ResourceBundle getResourceBundle(LogContext context)
           
static void mapLogContextToThread(java.lang.Thread t, LogContext logContext)
          Associates a log context with a thread.
static java.lang.String report()
          Generates a debugging report on the current state of the LogManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogManager

public LogManager()
Method Detail

configure

public static final LogContext configure(java.lang.String strLogConfigFile,
                                         java.lang.String strRootLogContext,
                                         java.lang.String strMessageBundleBase,
                                         java.util.Locale locale,
                                         java.lang.ClassLoader classLoader)
                                  throws java.lang.Exception
Configures the underlying logging system with the parameters specified. Each application will have its own config file identified by strLogConfigFile. Developers need to call this method prior to using any logging functions for proper logging behavior. Developers should be aware that if more than one configuration file is used i.e., you are running multiple apps, each with its own configuration file, their configuration parameters will be sharing the same namespace. It is STRONLY RECOMMENDED that you use a unique logical name as the root category name for all categories in your application. This will prevent one application's category names from conflicting with those of another application.

Parameters:
strLogConfigFile - - a file on the classpath available to the supplied ClassLoader that contains LOG4J configuration information that conforms to the LOG4J.dtd.
strRootLogContext - - the root log category for your application; this is used as the "key" for determining if the system has been configured correctly, i.e. it should be unique to your application.
strMessageBundleBase - - the base name for the message bundles containing log messages for your application
locale - - identifies the desired locale for displaying log messages
classLoader - - the ClassLoader to use to initialize log resources, such as ResourceBundles, log configuration file, etc.
Throws:
java.lang.Exception - if an error occurs while attempting to initialize the logging framework.

getLogger

public static final ILogger getLogger(LogContext context)
                               throws java.lang.IllegalStateException,
                                      java.lang.IllegalArgumentException

Parameters:
context - is a LogContext object
Returns:
an ILogger
Throws:
java.lang.IllegalStateException - - if there is no hierarchy for the locale of the log context or the locale for the log context is null
java.lang.IllegalArgumentException - - if the log context is null

getResourceBundle

public static final java.util.ResourceBundle getResourceBundle(LogContext context)

Returns:
the ResourceBundle for a given context

getLogContext

public static final LogContext getLogContext(java.lang.Thread t)
                                      throws java.lang.IllegalStateException,
                                             java.lang.IllegalArgumentException
Retrieves a log context for a thread.

Throws:
java.lang.IllegalStateException - if a log context has not been mapped for the thread passed in.

mapLogContextToThread

public static final void mapLogContextToThread(java.lang.Thread t,
                                               LogContext logContext)
Associates a log context with a thread. Allows a higher order component to set the log context for lower level components. Lower level components can create subcontexts from the return value. If a lower level component is not interested in creating a subcontext, it should just call the getLogger method with no arguments.

getLogger

public static final ILogger getLogger()
                               throws java.lang.IllegalStateException
A convenience method to retrieve a logger for the current running thread.

Returns:
the current logger for the current thread
Throws:
java.lang.IllegalStateException - if a log context has not been mapped for the current thread of execution.

report

public static final java.lang.String report()
Generates a debugging report on the current state of the LogManager

WebLogic Integration

WebLogic Integration (WLI)