org.apache.log.output

Class AbstractOutputTarget

Implemented Interfaces:
ErrorAware, LogTarget
Known Direct Subclasses:
DatagramOutputTarget, NullOutputLogTarget, SMTPOutputLogTarget, SocketOutputTarget, StreamTarget, WriterTarget

public abstract class AbstractOutputTarget
extends AbstractTarget

Abstract output target. Any new output target that is writing to a single connected resource should extend this class directly or indirectly.
Authors:
Avalon Development Team
Peter Donald

Field Summary

protected Formatter
m_formatter
Deprecated. You should not be directly accessing this attribute as it will become private next release

Constructor Summary

AbstractOutputTarget()
Parameterless constructor.
AbstractOutputTarget(Formatter formatter)
Creation of a new abstract output target instance.

Method Summary

void
close()
Shutdown target.
protected void
doProcessEvent(LogEvent event)
Process a log event.
Formatter
getFormatter()
Deprecated. Access to formatter is not advised and this method will be removed in future iterations.
protected void
open()
Startup log session.
protected void
output(String data)
Deprecated. User should overide write() instead of output().
void
setFormatter(Formatter formatter)
Deprecated. In future this method will become protected access.
protected void
write(String data)
Abstract method to write data.

Methods inherited from class org.apache.log.output.AbstractTarget

close, doProcessEvent, error, getErrorHandler, isOpen, open, processEvent, setErrorHandler

Field Details

m_formatter

protected Formatter m_formatter

Deprecated. You should not be directly accessing this attribute as it will become private next release

Formatter for target.

Constructor Details

AbstractOutputTarget

public AbstractOutputTarget()
Parameterless constructor.

AbstractOutputTarget

public AbstractOutputTarget(Formatter formatter)
Creation of a new abstract output target instance.
Parameters:
formatter - the formatter to apply

Method Details

close

public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.
Overrides:
close in interface AbstractTarget

doProcessEvent

protected void doProcessEvent(LogEvent event)
Process a log event.
Overrides:
doProcessEvent in interface AbstractTarget
Parameters:
event - the event to process

getFormatter

public Formatter getFormatter()

Deprecated. Access to formatter is not advised and this method will be removed in future iterations. It remains only for backwards compatability.

Retrieve the associated formatter.
Returns:
the formatter

open

protected void open()
Startup log session.
Overrides:
open in interface AbstractTarget

output

protected void output(String data)

Deprecated. User should overide write() instead of output(). Output exists for backwards compatability and will be removed in future.

Abstract method that will output event.
Parameters:
data - the data to be output

setFormatter

public void setFormatter(Formatter formatter)

Deprecated. In future this method will become protected access.

Set the formatter.
Parameters:
formatter - the formatter

write

protected void write(String data)
Abstract method to write data.
Parameters:
data - the data to be output