java.lang.Objectorg.apache.log4j.AppenderSkeleton
org.apache.log4j.net.SocketAppender
All Implemented Interfaces:
OptionHandler, Appender
The SocketAppender has the following properties:
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.
SocketAppender is no longer
attached to any category, it will not be garbage collected in
the presence of a connector thread. A connector thread exists
only if the connection to the server is down. To avoid this
garbage collection 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
garbage collection problem. Most other applications can safely
ignore it.
SocketAppender exits
before the SocketAppender is closed either
explicitly or subsequent to garbage collection, then there might
be untransmitted data in the pipe which might be lost. This is a
common problem on Windows based systems.
To avoid lost data, it is usually sufficient to #close the SocketAppender either explicitly or by
calling the org.apache.log4j.LogManager#shutdown method
before exiting the application.
Ceki - Gülcü0.8.4 - | Nested Class Summary: | ||
|---|---|---|
| class | SocketAppender.Connector | The Connector will reconnect when the server becomes available
again. It does this by attempting to open a new connection every
reconnectionDelay milliseconds.
It stops trying whenever a connection is established. It will restart to try reconnect to the server when previpously open connection is droppped. |
| Field Summary | ||
|---|---|---|
| public static final int | DEFAULT_PORT | The default port number of remote logging server (4560).
|
| static final int | DEFAULT_RECONNECTION_DELAY | The default reconnection delay (30000 milliseconds or 30 seconds). |
| String | remoteHost | We remember host name as String in addition to the resolved InetAddress so that it can be returned via getOption(). |
| InetAddress | address | |
| int | port | |
| ObjectOutputStream | oos | |
| int | reconnectionDelay | |
| boolean | locationInfo | |
| int | counter | |
| Fields inherited from org.apache.log4j.AppenderSkeleton: |
|---|
| layout, name, threshold, errorHandler, headFilter, tailFilter, closed |
| Constructor: |
|---|
|
address and port. |
host and port. |
| Method from org.apache.log4j.net.SocketAppender Summary: |
|---|
| activateOptions, append, cleanUp, close, connect, fireConnector, getAddressByName, getApplication, getLocationInfo, getPort, getReconnectionDelay, getRemoteHost, requiresLayout, setApplication, setLocationInfo, setPort, setReconnectionDelay, setRemoteHost |
| Methods from org.apache.log4j.AppenderSkeleton: |
|---|
| activateOptions, addFilter, append, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold |
| Methods from java.lang.Object: |
|---|
| equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from org.apache.log4j.net.SocketAppender Detail: |
|---|
|
|
|
This will mark the appender as closed and call then #cleanUp method. |
|
|
|
|
|
|
|
|
false. |
|
|
|
Setting this option to zero turns off reconnection capability. |
|