org.apache.log.output.net

Class SocketOutputTarget

public class SocketOutputTarget extends AbstractOutputTarget

SocketOutputTarget Useful for writing the output to a TCP/IP client socket.

Author: Rajendra Ghorpade

Field Summary
ObjectOutputStreamm_outputStream
Output strem to write the log
Socketm_socket
Socket to communicate with the server
Constructor Summary
SocketOutputTarget(InetAddress address, int port)
Creates output target with the end point specified by the address and port
SocketOutputTarget(String host, int port)
Creates the output target with the end point specified by host and port
Method Summary
voidclose()
Shutdown target.
protected voiddoProcessEvent(LogEvent event)
To process the LogEvent
protected voidwrite(LogEvent event)
Writes the output as a LogEvent without formatting.

Field Detail

m_outputStream

private ObjectOutputStream m_outputStream
Output strem to write the log

m_socket

private Socket m_socket
Socket to communicate with the server

Constructor Detail

SocketOutputTarget

public SocketOutputTarget(InetAddress address, int port)
Creates output target with the end point specified by the address and port

Parameters: address end point address port the end point port

Throws: IOException if an I/O error ocurrs when creating socket

SocketOutputTarget

public SocketOutputTarget(String host, int port)
Creates the output target with the end point specified by host and port

Parameters: host end point host port the end point port

Throws: IOException if an I/O error ocurrs when creating socket

Method Detail

close

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

doProcessEvent

protected void doProcessEvent(LogEvent event)
To process the LogEvent

Parameters: event the LogEvent

write

protected void write(LogEvent event)
Writes the output as a LogEvent without formatting. Formatting ia applied on the server side where it is log.

Parameters: event the LogEvent