Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.logging
Class LogCategory

    java.lang.Object
      org.apache.log4j.Category
          org.apache.log4j.Logger
              com.bea.logging.LogCategory

All Implemented Interfaces:
  org.apache.log4j.spi.AppenderAttachable, ILogger, INestedDiagnosticContext

public class LogCategory
extends org.apache.log4j.Logger
implements ILogger, INestedDiagnosticContext

Class LogCategory is the Logging Framework's base Class for logging. It extends the Logger class of the underlying implementation. It implements two interfaces: ILogger is the public interface to the logging facility. It is returned by the LogManager (c_categoryFactory) to clients wishing to log messages. The INestedDiagnosticContext interface simply exposes the methods of the underlying NDC class, without modifying their behavior.

Nested Class Summary
`static class` | `LogCategory.LogCategoryFactory` A factory for `LogCategory`instances.

Field Summary
`static LogCategory.LogCategoryFactory` | `c_categoryFactory`

Fields inherited from class org.apache.log4j.Category
`additive, level, name, parent, repository, resourceBundle`

Constructor Summary
`LogCategory(String strContext)` Create a new logging category

Method Summary
`void` | `addRuntimeDestination(PrintWriter writer)` Add a new destination at runtime.
`void` | `audit(String strKey)` Log a message with the audit priority using the strKey for message lookup.
`void` | `audit(String message, boolean isDirect)` Log a message with the audit priority.
`void` | `audit(String strKey, Object obj)` Convenience method which allows the useer to log an audit message with one argument to fill into the template.
`void` | `audit(String strKey, Object[] aInfo)` Log a message with the audit priority.
`void` | `audit(Throwable exception)` Log a message with the audit priority.
`void` | `clearNDC()` Clear any nested disgnostic information.
`Stack` | `cloneNDCStack()` Clone the diagnostic context for the current thread.
`void` | `debug(String strMessage)` Log a message with the debug priority.
`static void` | `dumpCategories()` This method will print the configuration for all Categories in the current default hierarchy.
`void` | `error(String strKey)` Log a message with the error priority.
`void` | `error(String message, boolean isDirect)` Log a message with the error priority.
`void` | `error(String strKey, Object obj)` Convenience method which allows the user to log an error message with one argument to fill into the template.
`void` | `error(String strKey, Object[] aInfo)` Log a message with the error priority.
`void` | `error(Throwable exception)` Log a message with the error priority.
`protected String` | `formatMessage(String strTemplateKey, Object[] aObj, boolean warnIfMissing)` formatMessage is used to format a pattern with arguments passed in a Object[]
`String` | `getI18NMessage(String strKey)` getI18NMessage(String) can be called to retrieve an Internationalized message string from a resource bundle.
`String` | `getI18NMessage(String strKey, Object obj)` Another convenience method, which allows the user to pass a single argument for replacement in the message template, without having to create an Object[]
`String` | `getI18NMessage(String strKey, Object[] aInfo)` getI18NMessage(String, Object[]) can be called to retrieve an Internationalized message string from a resource bundle.
`static LogCategory` | `getLogger(org.apache.log4j.Hierarchy hierarchy, LogContext context, ResourceBundle bundle)` This method is called by the LogManager to create an LogCategory instance.
`static org.apache.log4j.Logger` | `getLogger(String name)` Overrides parent getLogger() using our own c_categoryFactory instance.
`protected String` | `getLoggerInfo(org.apache.log4j.Logger c)`
`PrintWriter` | `getLogWriter()` Returns a PrintWriter for writing to an appropriate location.
`String` | `getNDC()` Used when printing the diagnostic context.
`int` | `getNDCDepth()` Get the current nesting depth of this diagnostic context
`INestedDiagnosticContext` | `getNDCInterface()` Method returns an interface to the static NDC methods that this object can access.
`String` | `getProperty(String strKey)` Gets raw property from the resource bundle
`void` | `info(String strKey)` Log a message with the info priority.
`void` | `info(String message, boolean isDirect)` Log a message with the INFO priority.
`void` | `info(String strKey, Object obj)` Convenience method which allows the user to log a warn message with one argument to fill into the template.
`void` | `info(String strKey, Object[] aInfo)` Log a message with the warn priority.
`void` | `inheritNDC(Stack stack)` Inherit the diagnostic context of another thread.
`void` | `popNDC()` Clients should call this method before leaving a diagnostic context.
`void` | `pushNDC(String message)` Push new diagnostic context information for the current thread.
`void` | `removeNDC()` Remove the diagnostic context for this thread
`void` | `setLevel(String strPriority)` This method sets the current LogCategory's priority to one of the established levels.
`void` | `setNDCMaxDepth(int depth)` Set maximum depth of this diagnostic context.
`void` | `setPriority(int intPriority)` This method overrides the method in super.
`void` | `setPriority(LogPriority priority)` This method overrides the method in super.
`void` | `setPriority(String strPriority)` This method overrides the method in super.
`String` | `toString()`
`void` | `warn(String strKey)` Log a message with the warn priority.
`void` | `warn(String message, boolean isDirect)` Log a message with the warn priority.
`void` | `warn(String strKey, Object obj)` Convenience method which allows the user to log a warn message with one argument to fill into the template.
`void` | `warn(String strKey, Object[] aInfo)` Log a message with the warn priority.
`void` | `warn(Throwable exception)` Log a message with the error priority.

Methods inherited from class org.apache.log4j.Logger
`getLogger, getLogger, getRootLogger`

Methods inherited from class org.apache.log4j.Category
`addAppender, assertLog, callAppenders, debug, debug, error, error, exists, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getInstance, getInstance, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, isAttached, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, setPriority, setResourceBundle, shutdown, warn, warn`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.bea.logging.ILogger
`isDebugEnabled, isInfoEnabled, setResourceBundle`

Field Detail

### c_categoryFactory

    public static LogCategory.LogCategoryFactory c_categoryFactory

Constructor Detail

### LogCategory

    public LogCategory(String strContext)

  Create a new logging category

Parameters:
  `strContext` - - identifies the category to log messages to...

Method Detail

### getLogger

    public static org.apache.log4j.Logger getLogger(String name)

  Overrides parent getLogger() using our own c_categoryFactory instance.

### getLogger

    public static LogCategory getLogger(org.apache.log4j.Hierarchy hierarchy,
                                        LogContext context,
                                        ResourceBundle bundle)

  This method is called by the LogManager to create an LogCategory instance.

  Parameters:
    `hierarchy` - - the category hierarchy to retrieve the LogCategory from; hierarchies are maintained for each active locale.
    `context` - is a LogContext object containing the name of the LogCategory
    `bundle` - - the message bundle for a log context; ResourceBundles are managed by the LogManager.
  Returns:
    a LogCategory. The LogManager returns an ILogger interface to the client after calling this method.

### addRuntimeDestination

    public void addRuntimeDestination(PrintWriter writer)

  Add a new destination at runtime.

  Specified by:
    `addRuntimeDestination` in interface `ILogger`
  Parameters:
    `writer` - - a new destination for log messages

### getLogWriter

    public PrintWriter getLogWriter()

  Description copied from interface: `ILogger`
  Returns a PrintWriter for writing to an appropriate location.

  Specified by:
    `getLogWriter` in interface `ILogger`
  Returns:
    a PrintWriter that prints to the destinations configured for this logger.

### setPriority

    public void setPriority(int intPriority)

  This method overrides the method in super. It sets the current LogCategory's priority to one of the established levels.

  Specified by:
    `setPriority` in interface `ILogger`
  Parameters:
    `intPriority` - is an integer that represents a logging priority level. See `com.bea.logging.LogPriority` for a set of static int values to use.

### setLevel

    public void setLevel(String strPriority)

  This method sets the current LogCategory's priority to one of the established levels.

  Specified by:
    `setLevel` in interface `ILogger`
  Parameters:
    `strPriority` - is a String name for an existing priority level.

### setPriority

    public void setPriority(String strPriority)

  This method overrides the method in super. It sets the current LogCategory's priority to one of the established levels.

  Specified by:
    `setPriority` in interface `ILogger`
  Parameters:
    `strPriority` - is a String name for an existing priority level.

### setPriority

    public void setPriority(LogPriority priority)

  This method overrides the method in super. It sets the current LogCategory's priority to one of the established levels.

  Specified by:
    `setPriority` in interface `ILogger`
  Parameters:
    `priority` - is a LogPriority object, which is constructed using one of the static int values in `LogPriority` as its argument.

### getProperty

    public String getProperty(String strKey)

  Gets raw property from the resource bundle

  Specified by:
    `getProperty` in interface `ILogger`
  Parameters:
    `strKey` - - specific key for the desired property.
  Returns:
    the value of the property or null if the property is not found.

### getI18NMessage

    public String getI18NMessage(String strKey)

  getI18NMessage(String) can be called to retrieve an Internationalized message string from a resource bundle. Rather than logging the resulting message, this method simply returns it to the caller. This is a convenience method for users who wish to include an I18N message in a new exception for example.

  Specified by:
    `getI18NMessage` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for lookup of a message in a ResourceBundle
  Returns:
    a String which is the message text (value) of the input key

### getI18NMessage

    public String getI18NMessage(String strKey,
                                 Object[] aInfo)

  getI18NMessage(String, Object[]) can be called to retrieve an Internationalized message string from a resource bundle. Rather than logging the resulting message, this method simply returns it to the caller. This is a convenience method for users who wish to include an I18N message in a new exception.

  Specified by:
    `getI18NMessage` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for lookup of a message in a ResourceBundle
    `aInfo` - is an Object[] of parameters to be replaced in the template returned by the key, strKey.
  Returns:
    a String which is the message text (value) of the input key, with the members of aInfo already replaced.

### getI18NMessage

    public String getI18NMessage(String strKey,
                                 Object obj)

  Another convenience method, which allows the user to pass a single argument for replacement in the message template, without having to create an Object[]

  Specified by:
    `getI18NMessage` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for lookup of a message in a ResourceBundle
    `obj` - is typically a String which will be added to an Object[], and replaced on the underlying message template.
  Returns:
    a String which is the message text (value) of the input key, with the obj param already replaced.

### formatMessage

    protected String formatMessage(String strTemplateKey,
                                   Object[] aObj,
                                   boolean warnIfMissing)

  formatMessage is used to format a pattern with arguments passed in a Object[]

  Parameters:
    `strTemplateKey` - is a "pattern" used by MessageFormat object
    `aObj` - is an Object[] of parameters for replacement in the Pattern
  Returns:
    a String which is the result of replacing the template keys with the values from the Object[] aObj

### audit

    public void audit(String strKey)

  Log a message with the audit priority using the strKey for message lookup. This method does not take any arguments for replacement in the final message. It simply returns the message associated with the @param strKey

  Specified by:
    `audit` in interface `ILogger`
  Parameters:
    `strKey` - - ResourceBundle key that identifies the correct value for substitution into the Locale specific message.

### audit

    public void audit(String message,
                      boolean isDirect)

  Log a message with the audit priority.

  Specified by:
    `audit` in interface `ILogger`
  Parameters:
    `message` - is just that, don't use it as a key for lookup
    `isDirect` - should be set to true (yeah, this is stupid) but necessary!

### audit

    public void audit(String strKey,
                      Object[] aInfo)

  Log a message with the audit priority.

  Specified by:
    `audit` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `aInfo` - is an Object[] of params to use with the specified template

### audit

    public void audit(String strKey,
                      Object obj)

  Convenience method which allows the useer to log an audit message with one argument to fill into the template.

  Specified by:
    `audit` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `obj` - is an object (typically a String) to use with the specified template

### audit

    public void audit(Throwable exception)

  Log a message with the audit priority.

  Specified by:
    `audit` in interface `ILogger`
  Parameters:
    `exception` - is the exception to log. We include a stack trace in the log message.

### error

    public void error(String strKey)

  Log a message with the error priority.

  Specified by:
    `error` in interface `ILogger`
  Parameters:
    `strKey` - used as a key for lookup of the actual message.

### error

    public void error(String message,
                      boolean isDirect)

  Log a message with the error priority.

  Specified by:
    `error` in interface `ILogger`
  Parameters:
    `message` - is just that, don't use it as a key for lookup
    `isDirect` - should be set to true (yeah, this is stupid)

### error

    public void error(String strKey,
                      Object[] aInfo)

  Log a message with the error priority.

  Specified by:
    `error` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `aInfo` - is an Object[] of params to use with the specified template

### error

    public void error(String strKey,
                      Object obj)

  Convenience method which allows the user to log an error message with one argument to fill into the template.

  Specified by:
    `error` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `obj` - is an object (typically a String) to use with the specified template

### error

    public void error(Throwable exception)

  Log a message with the error priority.

  Specified by:
    `error` in interface `ILogger`
  Parameters:
    `exception` - is the exception to log. We include a stack trace in the log message.

### warn

    public void warn(String strKey)

  Log a message with the warn priority.

  Specified by:
    `warn` in interface `ILogger`
  Parameters:
    `strKey` - used as a key for lookup of the actual message.

### warn

    public void warn(String message,
                     boolean isDirect)

  Log a message with the warn priority.

  Specified by:
    `warn` in interface `ILogger`
  Parameters:
    `message` - is just that, don't use it as a key for lookup
    `isDirect` - should be set to true (yeah, this is stupid)

### warn

    public void warn(String strKey,
                     Object[] aInfo)

  Log a message with the warn priority.

  Specified by:
    `warn` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `aInfo` - is an Object[] of params to use with the specified template

### warn

    public void warn(String strKey,
                     Object obj)

  Convenience method which allows the user to log a warn message with one argument to fill into the template.

  Specified by:
    `warn` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `obj` - is an object (typically a String) to use with the specified template

### warn

    public void warn(Throwable exception)

  Log a message with the error priority.

  Specified by:
    `warn` in interface `ILogger`
  Parameters:
    `exception` - is the exception to log. We include a stack trace in the log message.

### info

    public void info(String strKey)

  Log a message with the info priority.

  Specified by:
    `info` in interface `ILogger`
  Parameters:
    `strKey` - is a key for message lookup

### info

    public void info(String message,
                     boolean isDirect)

  Log a message with the INFO priority.

  Specified by:
    `info` in interface `ILogger`
  Parameters:
    `message` - is just that, don't use it as a key for lookup
    `isDirect` - should be set to true (yeah, this is stupid)

### info

    public void info(String strKey,
                     Object[] aInfo)

  Log a message with the warn priority.

  Specified by:
    `info` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `aInfo` - is an Object[] of params to use with the specified template

### info

    public void info(String strKey,
                     Object obj)

  Convenience method which allows the user to log a warn message with one argument to fill into the template.

  Specified by:
    `info` in interface `ILogger`
  Parameters:
    `strKey` - is a String key for looking up the template in the resource bundle.
    `obj` - is an object (typically a String) to use with the specified template

### debug

    public void debug(String strMessage)

  Log a message with the debug priority. DEBUG does not allow internationalization because these messages are typically of use to the developer only.

  Specified by:
    `debug` in interface `ILogger`
  Parameters:
    `strMessage` - is a message

### getNDCInterface

    public INestedDiagnosticContext getNDCInterface()

  Method returns an interface to the static NDC methods that this object can access. It is wrapper for the client.

  Specified by:
    `getNDCInterface` in interface `ILogger`
  Returns:
    interface INestedDiagnosticContext

### clearNDC

    public void clearNDC()

  Clear any nested disgnostic information.

  Specified by:
    `clearNDC` in interface `INestedDiagnosticContext`

### cloneNDCStack

    public Stack cloneNDCStack()

  Clone the diagnostic context for the current thread.

  Specified by:
    `cloneNDCStack` in interface `INestedDiagnosticContext`
  Returns:
    a stack for the current NDC

### getNDC

    public String getNDC()

  Used when printing the diagnostic context.

  Specified by:
    `getNDC` in interface `INestedDiagnosticContext`

### getNDCDepth

    public int getNDCDepth()

  Get the current nesting depth of this diagnostic context

  Specified by:
    `getNDCDepth` in interface `INestedDiagnosticContext`

### inheritNDC

    public void inheritNDC(Stack stack)

  Inherit the diagnostic context of another thread.

  Specified by:
    `inheritNDC` in interface `INestedDiagnosticContext`

### popNDC

    public void popNDC()

  Clients should call this method before leaving a diagnostic context.

  Specified by:
    `popNDC` in interface `INestedDiagnosticContext`

### pushNDC

    public void pushNDC(String message)

  Push new diagnostic context information for the current thread.

  Specified by:
    `pushNDC` in interface `INestedDiagnosticContext`

### removeNDC

    public void removeNDC()

  Remove the diagnostic context for this thread

  Specified by:
    `removeNDC` in interface `INestedDiagnosticContext`

### setNDCMaxDepth

    public void setNDCMaxDepth(int depth)

  Set maximum depth of this diagnostic context.

  Specified by:
    `setNDCMaxDepth` in interface `INestedDiagnosticContext`

### toString

    public String toString()

  Returns:
    a String representation of my current state

### getLoggerInfo

    protected String getLoggerInfo(org.apache.log4j.Logger c)

### dumpCategories

    public static void dumpCategories()

  This method will print the configuration for all Categories in the current default hierarchy. It prints each category name, priority, and a list of all appenders by name.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD