Top Description Fields Constructors Methods
org.apache.log.output.net

public Class SocketOutputTarget

extends AbstractOutputTarget
Class Inheritance
Imports
java.io.IOException, .ObjectOutputStream, java.net.InetAddress, .Socket, org.apache.log.LogEvent, org.apache.log.output.AbstractOutputTarget

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

Field Summary

Modifier and TypeField and Description
private ObjectOutputStream
m_outputStream

Output strem to write the log

private Socket
m_socket

Socket to communicate with the server

Constructor Summary

AccessConstructor and Description
public
SocketOutputTarget(final InetAddress
end point address
address
,
final int
the end point port
port
)

Creates output target with the end point specified by the address and port

public
SocketOutputTarget(final String
end point host
host
,
final int
the end point port
port
)

Creates the output target with the end point specified by host and port

Method Summary

Modifier and TypeMethod and Description
public synchronized void
protected void
doProcessEvent(LogEvent
the LogEvent
event
)

Overrides org.apache.log.output.AbstractOutputTarget.doProcessEvent.

To process the LogEvent
protected void
write(LogEvent
the LogEvent
event
)

Writes the output as a LogEvent without formatting.

Inherited from org.apache.log.output.AbstractOutputTarget:
getFormatteropenwrite

Field Detail

m_outputStreamback to summary
private ObjectOutputStream m_outputStream

Output strem to write the log

m_socketback to summary
private Socket m_socket

Socket to communicate with the server

Constructor Detail

SocketOutputTargetback to summary
public SocketOutputTarget(final InetAddress address, final int port) throws IOException

Creates output target with the end point specified by the address and port

Parameters
address:InetAddress

end point address

port:int

the end point port

Exceptions
IOException:
if an I/O error ocurrs when creating socket
SocketOutputTargetback to summary
public SocketOutputTarget(final String host, final int port) throws IOException

Creates the output target with the end point specified by host and port

Parameters
host:String

end point host

port:int

the end point port

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

Method Detail

closeback to summary
public synchronized void close()

Overrides org.apache.log.output.AbstractOutputTarget.close.

Implements org.apache.log.util.Closeable.close.

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

doProcessEventback to summary
protected void doProcessEvent(LogEvent event)

Overrides org.apache.log.output.AbstractOutputTarget.doProcessEvent.

To process the LogEvent

Parameters
event:LogEvent

the LogEvent

writeback to summary
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:LogEvent

the LogEvent