AbstractTarget (LogKit API)
Keywords: org.apache.log.output.AbstractTarget,AbstractTarget 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.output
Class AbstractTarget

    java.lang.Object
      |
      +--org.apache.log.output.AbstractTarget

All Implemented Interfaces:
  ErrorAware, LogTarget

Direct Known Subclasses:
  AbstractJDBCTarget, AbstractJMSTarget, AbstractOutputTarget, AsyncLogTarget, MemoryTarget

public abstract class AbstractTarget
extends Object
implements LogTarget, ErrorAware

Abstract target.

Author:
  Avalon Development Team, Peter Donald

Constructor Summary
`AbstractTarget()` AbstractTarget constructor.
`AbstractTarget(ErrorHandler errorHandler)` AbstractTarget constructor.

Method Summary
`void` | `close()` Shutdown target.
`protected abstract void` | `doProcessEvent(LogEvent event)` Process a log event, via formatting and outputting it.
`protected void` | `error(String message, Throwable throwable)` Deprecated. Use getErrorHandler().error(...) directly
`protected ErrorHandler` | `getErrorHandler()` Helper method to retrieve ErrorHandler for subclasses.
`protected boolean` | `isOpen()` Return the open state of the target.
`protected void` | `open()` Startup log session.
`void` | `processEvent(LogEvent event)` Process a log event, via formatting and outputting it.
`void` | `setErrorHandler(ErrorHandler errorHandler)` Provide component with ErrorHandler.

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

Constructor Detail

### AbstractTarget

    public AbstractTarget()

  AbstractTarget constructor.

### AbstractTarget

    public AbstractTarget(ErrorHandler errorHandler)

  AbstractTarget constructor.

Parameters:
  `errorHandler` - the error handler

Method Detail

### setErrorHandler

    public void setErrorHandler(ErrorHandler errorHandler)

  Provide component with ErrorHandler.

  Specified by:
    `setErrorHandler` in interface `ErrorAware`
  Parameters:
    `errorHandler` - the errorHandler

### isOpen

    protected boolean isOpen()

  Return the open state of the target.

  Returns:
    TRUE if the target is open else FALSE

### open

    protected void open()

  Startup log session.

### processEvent

    public void processEvent(LogEvent event)

  Process a log event, via formatting and outputting it.

  Specified by:
    `processEvent` in interface `LogTarget`
  Parameters:
    `event` - the log event

### doProcessEvent

    protected abstract void doProcessEvent(LogEvent event)
                                    throws Exception

  Process a log event, via formatting and outputting it. This should be overidden by subclasses.

  Parameters:
    `event` - the log event
  Throws:
    `Exception` - if an event processing error occurs

### close

    public void close()

  Shutdown target. Attempting to write to target after close() will cause errors to be logged.

### getErrorHandler

    protected final ErrorHandler getErrorHandler()

  Helper method to retrieve ErrorHandler for subclasses.

  Returns:
    the ErrorHandler

### error

    protected final void error(String message,
                               Throwable throwable)

  Deprecated. Use getErrorHandler().error(...) directly

  Helper method to write error messages to error handler.

  Parameters:
    `message` - the error message
    `throwable` - the exception if any

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.