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

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

All Implemented Interfaces:
  ErrorAware, LogTarget, Runnable

public class AsyncLogTarget
extends AbstractTarget
implements Runnable

An asynchronous LogTarget that sends entries on in another thread. It is the responsibility of the user of this class to start the thread etc.

     LogTarget mySlowTarget = ...;
     AsyncLogTarget asyncTarget = new AsyncLogTarget( mySlowTarget );
     Thread thread = new Thread( asyncTarget );
     thread.setPriority( Thread.MIN_PRIORITY );
     thread.start();

     logger.setLogTargets( new LogTarget[] { asyncTarget } );

Author:
  Avalon Development Team, Peter Donald

Constructor Summary
`AsyncLogTarget(LogTarget logTarget)` Creation of a new async log target.
`AsyncLogTarget(LogTarget logTarget, int queueSize)` Creation of a new async log target.

Method Summary
`void` | `doProcessEvent(LogEvent event)` Process a log event by adding it to queue.
`void` | `run()` Thread startup.
`void` | `setErrorHandler(ErrorHandler errorHandler)` Provide component with ErrorHandler.

Methods inherited from class org.apache.log.output.AbstractTarget
`close, error, getErrorHandler, isOpen, open, processEvent`

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

Constructor Detail

### AsyncLogTarget

    public AsyncLogTarget(LogTarget logTarget)

  Creation of a new async log target.

Parameters:
  `logTarget` - the underlying target

### AsyncLogTarget

    public AsyncLogTarget(LogTarget logTarget,
                          int queueSize)

  Creation of a new async log target.

Parameters:
  `logTarget` - the underlying target
  `queueSize` - the queue size

Method Detail

### setErrorHandler

    public void setErrorHandler(ErrorHandler errorHandler)

  Provide component with ErrorHandler.

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

### doProcessEvent

    public void doProcessEvent(LogEvent event)

  Process a log event by adding it to queue.

  Specified by:
    `doProcessEvent` in class `AbstractTarget`
  Parameters:
    `event` - the log event

### run

    public void run()

  Thread startup.

  Specified by:
    `run` in interface `Runnable`

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.