Hierarchy (LogKit API)
Keywords: org.apache.log.Hierarchy,Hierarchy class

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

## org.apache.log
Class Hierarchy

    java.lang.Object
      |
      +--org.apache.log.Hierarchy

public class Hierarchy
extends Object

This class encapsulates a basic independent log hierarchy. The hierarchy is essentially a safe wrapper around root logger.

Author:
  Avalon Development Team, Peter Donald

Constructor Summary
`Hierarchy()` Create a hierarchy object.

Method Summary
`void` | `addLoggerListener(LoggerListener loggerListener)` Set the LoggerListener associated with hierarchy.
`static Hierarchy` | `getDefaultHierarchy()` Retrieve the default hierarchy.
`Logger` | `getLoggerFor(String category)` Retrieve a logger for named category.
`Logger` | `getRootLogger()` Utility method to retrieve logger for hierarchy.
`void` | `log(String message)` Deprecated. Logging components should use ErrorHandler rather than Hierarchy.log()
`void` | `log(String message, Throwable throwable)` Deprecated. Logging components should use ErrorHandler rather than Hierarchy.log()
`void` | `removeLoggerListener(LoggerListener loggerListener)` Remove the LoggerListener associated with hierarchy.
`void` | `setDefaultLogTarget(LogTarget target)` Set the default log target for hierarchy.
`void` | `setDefaultLogTargets(LogTarget[] targets)` Set the default log targets for this hierarchy.
`void` | `setDefaultPriority(Priority priority)` Set the default priority for hierarchy.
`void` | `setErrorHandler(ErrorHandler errorHandler)` Set the ErrorHandler associated with hierarchy.

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

Constructor Detail

### Hierarchy

    public Hierarchy()

  Create a hierarchy object. The default LogTarget writes to stdout.

Method Detail

### getDefaultHierarchy

    public static Hierarchy getDefaultHierarchy()

  Retrieve the default hierarchy.

  In most cases the default LogHierarchy is the only one used in an application. However when security is a concern or multiple independent applications will be running in same JVM it is advantageous to create new Hierarchies rather than reuse default.

  Returns:
    the default Hierarchy

### setDefaultLogTarget

    public void setDefaultLogTarget(LogTarget target)

  Set the default log target for hierarchy. This is the target inherited by loggers if no other target is specified.

  Parameters:
    `target` - the default target

### setDefaultLogTargets

    public void setDefaultLogTargets(LogTarget[] targets)

  Set the default log targets for this hierarchy. These are the targets inherited by loggers if no other targets are specified

  Parameters:
    `targets` - the default targets

### setDefaultPriority

    public void setDefaultPriority(Priority priority)

  Set the default priority for hierarchy. This is the priority inherited by loggers if no other priority is specified.

  Parameters:
    `priority` - the default priority

### setErrorHandler

    public void setErrorHandler(ErrorHandler errorHandler)

  Set the ErrorHandler associated with hierarchy.

  Parameters:
    `errorHandler` - the ErrorHandler

### addLoggerListener

    public void addLoggerListener(LoggerListener loggerListener)

  Set the LoggerListener associated with hierarchy. This is a unicast listener, so only one LoggerListener is allowed.

  Parameters:
    `loggerListener` - the LoggerListener
  Throws:
    `UnsupportedOperationException` - if no more LoggerListeners are permitted.

### removeLoggerListener

    public void removeLoggerListener(LoggerListener loggerListener)

  Remove the LoggerListener associated with hierarchy. Perform this step before adding a new one if you want to change it.

  Parameters:
    `loggerListener` - the LoggerListener

### getLoggerFor

    public Logger getLoggerFor(String category)

  Retrieve a logger for named category.

  Parameters:
    `category` - the context
  Returns:
    the Logger

### log

    public void log(String message,
                    Throwable throwable)

  Deprecated. Logging components should use ErrorHandler rather than Hierarchy.log()

  Logs an error message to error handler. Default Error Handler is stderr.

  Parameters:
    `message` - a message to log
    `throwable` - a Throwable to log

### log

    public void log(String message)

  Deprecated. Logging components should use ErrorHandler rather than Hierarchy.log()

  Logs an error message to error handler. Default Error Handler is stderr.

  Parameters:
    `message` - a message to log

### getRootLogger

    public final Logger getRootLogger()

  Utility method to retrieve logger for hierarchy. This method is intended for use by sub-classes which can take responsibility for manipulating Logger directly.

  Returns:
    the Logger

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

Copyright © 2001 Apache Jakarta Project. All Rights Reserved.