Public Member Functions | |
SocketAppender (unsigned long address, int port) | |
SocketAppender (const String &host, int port) | |
void | activateOptions () |
virtual void | setOption (const String &option, const String &value) |
void | close () |
void | cleanUp () |
virtual void | append (const spi::LoggingEventPtr &event) |
bool | requiresLayout () const |
void | setRemoteHost (const String &host) |
const String & | getRemoteHost () const |
void | setPort (int port) |
int | getPort () const |
void | setLocationInfo (bool locationInfo) |
bool | getLocationInfo () const |
void | setReconnectionDelay (int reconnectionDelay) |
int | getReconnectionDelay () const |
Static Public Attributes | |
static int | DEFAULT_PORT |
static int | DEFAULT_RECONNECTION_DELAY |
Protected Attributes | |
String | remoteHost |
helpers::InetAddress | address |
The SocketAppender has the following properties:
SocketAppender
is no longer attached to any logger, it will not be destroyed in the presence of a connector thread. A connector thread exists only if the connection to the server is down. To avoid this destruction problem, you should close the the SocketAppender
explicitly. See also next item. SocketAppender
instances should be aware of this destruction problem. Most other applications can safely ignore it.
SocketAppender
exits before the SocketAppender
is closed either explicitly or subsequent to destruction, then there might be untransmitted data in the pipe which might be lost. SocketAppender
either explicitly or by calling the LogManager::shutdown method before exiting the application.
SocketAppender | ( | unsigned long | address, | |
int | port | |||
) |
Connects to remote server at address
and port
.
SocketAppender | ( | const String & | host, | |
int | port | |||
) |
Connects to remote server at host
and port
.
void activateOptions | ( | ) | [virtual] |
Connect to the specified RemoteHost and Port.
Reimplemented from AppenderSkeleton.
void setOption | ( | const String & | option, | |
const String & | value | |||
) | [virtual] |
Set options
Reimplemented from AppenderSkeleton.
void close | ( | ) | [virtual] |
void cleanUp | ( | ) |
Drop the connection to the remote host and release the underlying connector thread if it has been created
void append | ( | const spi::LoggingEventPtr & | event | ) | [virtual] |
Subclasses of AppenderSkeleton
should implement this method to perform actual logging. See also AppenderSkeleton::doAppend method.
Implements AppenderSkeleton.
bool requiresLayout | ( | ) | const [inline, virtual] |
The SocketAppender does not use a layout. Hence, this method returns false
.
Implements Appender.
void setRemoteHost | ( | const String & | host | ) | [inline] |
The RemoteHost option takes a string value which should be the host name of the server where a SocketNode is running.
const String& getRemoteHost | ( | ) | const [inline] |
Returns value of the RemoteHost option.
void setPort | ( | int | port | ) | [inline] |
The Port option takes a positive integer representing the port where the server is waiting for connections.
int getPort | ( | ) | const [inline] |
Returns value of the Port option.
void setLocationInfo | ( | bool | locationInfo | ) | [inline] |
The LocationInfo option takes a boolean value. If true, the information sent to the remote host will include location information. By default no location information is sent to the server.
bool getLocationInfo | ( | ) | const [inline] |
Returns value of the LocationInfo option.
void setReconnectionDelay | ( | int | reconnectionDelay | ) | [inline] |
The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server. The default value of this option is 30000 which corresponds to 30 seconds.
Setting this option to zero turns off reconnection capability.
int getReconnectionDelay | ( | ) | const [inline] |
Returns value of the ReconnectionDelay option.
int DEFAULT_PORT [static] |
The default port number of remote logging server (4560).
int DEFAULT_RECONNECTION_DELAY [static] |
The default reconnection delay (30000 milliseconds or 30 seconds).
String remoteHost [protected] |
host name
helpers::InetAddress address [protected] |
IP address