log4cplus  2.0.0
Public Member Functions | Protected Member Functions | Protected Attributes
log4cplus::SocketAppender Class Reference

Sends spi::InternalLoggingEvent objects to a remote a log server. More...

#include <socketappender.h>

Inheritance diagram for log4cplus::SocketAppender:
[legend]
Collaboration diagram for log4cplus::SocketAppender:
[legend]

List of all members.

Public Member Functions

 SocketAppender (const log4cplus::tstring &host, unsigned short port, const log4cplus::tstring &serverName=tstring(), bool ipv6=false)
 SocketAppender (const log4cplus::helpers::Properties &properties)
 ~SocketAppender ()
virtual void close ()
 Release any resources allocated within the appender such as file handles, network connections, etc.

Protected Member Functions

void openSocket ()
void initConnector ()
virtual void append (const spi::InternalLoggingEvent &event)
 Subclasses of Appender should implement this method to perform actual logging.
virtual thread::Mutex const & ctcGetAccessMutex () const
virtual helpers::SocketctcGetSocket ()
virtual helpers::Socket ctcConnect ()
virtual void ctcSetConnected ()
 Sets connected flag to true in ConnectorThread's client.

Protected Attributes

log4cplus::helpers::Socket socket
log4cplus::tstring host
unsigned int port
log4cplus::tstring serverName
bool ipv6 = false
volatile bool connected
helpers::SharedObjectPtr
< helpers::ConnectorThread
connector

Detailed Description

Sends spi::InternalLoggingEvent objects to a remote a log server.

The SocketAppender has the following properties:

Properties

host

Remote host name to connect and send events to.

port

Port on remote host to send events to.

ServerName

Host name of event's origin prepended to each event.

IPv6

Boolean value specifying whether to use IPv6 (true) or IPv4 (false). Default value is false.

Definition at line 105 of file socketappender.h.


Constructor & Destructor Documentation

log4cplus::SocketAppender::SocketAppender ( const log4cplus::tstring host,
unsigned short  port,
const log4cplus::tstring serverName = tstring(),
bool  ipv6 = false 
)

Member Function Documentation

virtual void log4cplus::SocketAppender::append ( const spi::InternalLoggingEvent event) [protected, virtual]

Subclasses of Appender should implement this method to perform actual logging.

See also:
doAppend method.

Implements log4cplus::Appender.

virtual void log4cplus::SocketAppender::close ( ) [virtual]

Release any resources allocated within the appender such as file handles, network connections, etc.

It is a programming error to append to a closed appender.

Implements log4cplus::Appender.

virtual helpers::Socket log4cplus::SocketAppender::ctcConnect ( ) [protected, virtual]
Returns:
ConnectorThread client's function returning connected socket.

Implements log4cplus::helpers::IConnectorThreadClient.

virtual thread::Mutex const& log4cplus::SocketAppender::ctcGetAccessMutex ( ) const [protected, virtual]
Returns:
Mutex for synchronization between ConnectorThread and its client object. This is usually SharedObject::access_mutex.

Implements log4cplus::helpers::IConnectorThreadClient.

virtual helpers::Socket& log4cplus::SocketAppender::ctcGetSocket ( ) [protected, virtual]
Returns:
Socket variable in ConnectorThread client to maintain.

Implements log4cplus::helpers::IConnectorThreadClient.

virtual void log4cplus::SocketAppender::ctcSetConnected ( ) [protected, virtual]

Sets connected flag to true in ConnectorThread's client.

Implements log4cplus::helpers::IConnectorThreadClient.


Member Data Documentation

volatile bool log4cplus::SocketAppender::connected [protected]

Definition at line 142 of file socketappender.h.

Definition at line 143 of file socketappender.h.

Definition at line 131 of file socketappender.h.

bool log4cplus::SocketAppender::ipv6 = false [protected]

Definition at line 134 of file socketappender.h.

unsigned int log4cplus::SocketAppender::port [protected]

Definition at line 132 of file socketappender.h.

Definition at line 133 of file socketappender.h.

Definition at line 130 of file socketappender.h.


The documentation for this class was generated from the following file: