|
| SocketAppender () |
|
| ~SocketAppender () |
|
| SocketAppender (helpers::InetAddressPtr &address, int port) |
| Connects to remote server at address and port . More...
|
|
| SocketAppender (const LogString &host, int port) |
| Connects to remote server at host and port . More...
|
|
| SocketAppenderSkeleton (int defaultPort, int reconnectionDelay) |
|
| ~SocketAppenderSkeleton () |
|
| SocketAppenderSkeleton (helpers::InetAddressPtr address, int port, int reconnectionDelay) |
| Connects to remote server at address and port . More...
|
|
| SocketAppenderSkeleton (const LogString &host, int port, int reconnectionDelay) |
| Connects to remote server at host and port . More...
|
|
void | activateOptions (log4cxx::helpers::Pool &p) |
| Connect to the specified RemoteHost and Port. More...
|
|
void | close () |
| Release any resources allocated within the appender such as file handles, network connections, etc. More...
|
|
bool | requiresLayout () const |
| This appender does not use a layout. More...
|
|
void | setRemoteHost (const LogString &host) |
| The RemoteHost option takes a string value which should be the host name of the server where a Apache Chainsaw or compatible is running. More...
|
|
const LogString & | getRemoteHost () const |
| Returns value of the RemoteHost option. More...
|
|
void | setPort (int port1) |
| The Port option takes a positive integer representing the port where the server is waiting for connections. More...
|
|
int | getPort () const |
| Returns value of the Port option. More...
|
|
void | setLocationInfo (bool locationInfo1) |
| The LocationInfo option takes a boolean value. More...
|
|
bool | getLocationInfo () const |
| Returns value of the LocationInfo option. More...
|
|
void | setReconnectionDelay (int reconnectionDelay1) |
| The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server. More...
|
|
int | getReconnectionDelay () const |
| Returns value of the ReconnectionDelay option. More...
|
|
void | fireConnector () |
|
void | setOption (const LogString &option, const LogString &value) |
| Set option to value . More...
|
|
| AppenderSkeleton () |
|
| AppenderSkeleton (const LayoutPtr &layout) |
|
void | addRef () const |
|
void | releaseRef () const |
|
void | finalize () |
| Finalize this appender by calling the derived class' close method. More...
|
|
void | addFilter (const spi::FilterPtr &newFilter) |
| Add a filter to end of the filter list. More...
|
|
void | clearFilters () |
| Clear the filters chain. More...
|
|
const spi::ErrorHandlerPtr & | getErrorHandler () const |
| Return the currently set spi::ErrorHandler for this Appender. More...
|
|
spi::FilterPtr | getFilter () const |
| Returns the head Filter. More...
|
|
const spi::FilterPtr & | getFirstFilter () const |
| Return the first filter in the filter chain for this Appender. More...
|
|
LayoutPtr | getLayout () const |
| Returns the layout of this appender. More...
|
|
LogString | getName () const |
| Returns the name of this Appender. More...
|
|
const LevelPtr & | getThreshold () const |
| Returns this appenders threshold level. More...
|
|
bool | isAsSevereAsThreshold (const LevelPtr &level) const |
| Check whether the message level is below the appender's threshold. More...
|
|
virtual void | doAppend (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
| This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific AppenderSkeleton::append method. More...
|
|
void | setErrorHandler (const spi::ErrorHandlerPtr &eh) |
| Set the ErrorHandler for this Appender. More...
|
|
void | setLayout (const LayoutPtr &layout1) |
| Set the layout for this appender. More...
|
|
void | setName (const LogString &name1) |
| Set the name of this Appender. More...
|
|
void | setThreshold (const LevelPtr &threshold) |
| Set the threshold level. More...
|
|
virtual | ~Appender () |
|
Public Member Functions inherited from OptionHandler |
virtual | ~OptionHandler () |
|
virtual const helpers::Class & | getClass () const |
|
virtual | ~Object () |
|
virtual bool | instanceof (const Class &clazz) const =0 |
|
virtual const void * | cast (const Class &clazz) const =0 |
|
| ObjectImpl () |
|
virtual | ~ObjectImpl () |
|
void | addRef () const |
|
void | releaseRef () const |
|
Sends LoggingEvent objects to a remote a log server, usually Apache Chainsaw.
The SocketAppender has the following properties:
- If sent to Apache Chainsaw, remote logging is non-intrusive as far as the log event is concerned. In other words, the event will be logged with the same time stamp, NDC, location info as if it were logged locally by the client.
- SocketAppenders do not use a layout. They ship a serialized LoggingEvent object to the server side.
- Remote logging uses the TCP protocol. Consequently, if the server is reachable, then log events will eventually arrive at the server.
- If the remote server is down, the logging requests are simply dropped. However, if and when the server comes back up, then event transmission is resumed transparently. This transparent reconneciton is performed by a connector thread which periodically attempts to connect to the server.
- Logging events are automatically buffered by the native TCP implementation. This means that if the link to server is slow but still faster than the rate of (log) event production by the client, the client will not be affected by the slow network connection. However, if the network connection is slower then the rate of event production, then the client can only progress at the network rate. In particular, if the network link to the the server is down, the client will be blocked.
On the other hand, if the network link is up, but the server is down, the client will not be blocked when making log requests but the log events will be lost due to server unavailability.
- Even if a
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.
Long lived applications which create/destroy many SocketAppender
instances should be aware of this destruction problem. Most other applications can safely ignore it.
- If the application hosting the
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.
To avoid lost data, it is usually sufficient to close the SocketAppender
either explicitly or by calling the LogManager::shutdown method before exiting the application.