com.bea.logging
Class LogContext

java.lang.Object
  extended bycom.bea.logging.LogContext
All Implemented Interfaces:
Cloneable, Serializable

public class LogContext
extends Object
implements Cloneable, Serializable

A class that encapsulates information to help determine its logging configuration in the logging framework. Specifically, a LogContext is a logging category and locale. This class is tightly coupled to the underlying implementation of the logging framework. In other words, if the underlying implementation changes, this class is likely to change.

Author:
Copyright (c) 1998-2000 by BEA Systems, Inc. All Rights Reserved.
See Also:
Serialized Form

Constructor Summary
LogContext()
          Creates an object used to retrieve an ILogger instance for the ROOT of the logging hierarchy and does NOT allow for localization of log messages.
LogContext(String strContext)
          Creates an object used to retrieve an ILogger instance associated with strContext in the logging hierarchy and does NOT allow for localization of log messages.
LogContext(String strContext, Locale locale)
          Creates an object used to retrieve an ILogger instance associated with strContext in the logging hierarchy and does attempts to create a ResourceBundle using strContext and locale.
 
Method Summary
 void appendContext(String strAppend)
          Appends additional context information to this context in a implementation dependent manner.
 Object clone()
           
 void dumpLogContext()
           
 boolean equals(Object obj)
           
 Locale getLocale()
           
 LogContext getParent()
           
 int hashCode()
           
static String join(String strBase, String strNew)
          Joins strBase with strNew in a logging framework dependent manner.
 LogContext subContext(String strSubContext)
          Creates a new LogContext object with this context as its base context.
 String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LogContext

public LogContext()
Creates an object used to retrieve an ILogger instance for the ROOT of the logging hierarchy and does NOT allow for localization of log messages. Using the ILogger methods that rely on a ResourceBundle will result in an IllegalStateException. If the invoker desires localization of log messages, they should use constructor that takes a java.util.Locale.

See Also:
LogContext(String, Locale)

LogContext

public LogContext(String strContext)
Creates an object used to retrieve an ILogger instance associated with strContext in the logging hierarchy and does NOT allow for localization of log messages. Using the ILogger methods that rely on a ResourceBundle will result in an IllegalStateException. If the invoker desires localization of log messages, they should use constructor that takes a java.util.Locale.

Parameters:
strContext - - identifies this context in the logging category hierarchy.
See Also:
LogContext(String, Locale)

LogContext

public LogContext(String strContext,
                  Locale locale)
Creates an object used to retrieve an ILogger instance associated with strContext in the logging hierarchy and does attempts to create a ResourceBundle using strContext and locale.

Parameters:
strContext - - identifies an ILogger instance in the logging framework.
locale - - identifies which locale to use for localization of log messages.
Throws:
MissingResourceException - - the ResourceBundle for strContext and locale cannot be located; make sure the class or properties file is in the JVM's classpath.
Method Detail

getParent

public LogContext getParent()
Returns:
the parent context for this context; may return null if this context is the logical root, i.e. has context ""

appendContext

public void appendContext(String strAppend)
Appends additional context information to this context in a implementation dependent manner. This method is synchronized because it alters the state of the object.

Parameters:
strAppend - - additional contextual information for determining logging configuration in the logging framework.

subContext

public LogContext subContext(String strSubContext)
Creates a new LogContext object with this context as its base context.

Parameters:
strSubContext - - additional contextual information used to identify a new sub context below this one in the hierarchy.
Returns:
a new LogContext object

toString

public final String toString()
Returns:
a String representation of this context name.

getLocale

public final Locale getLocale()
Returns:
the java.util.Locale for this; may be null.

clone

public Object clone()
             throws CloneNotSupportedException
Throws:
CloneNotSupportedException

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

dumpLogContext

public void dumpLogContext()

join

public static String join(String strBase,
                          String strNew)
Joins strBase with strNew in a logging framework dependent manner.