@Plugin(name="Socket", category="Core", elementType="appender", printObject=true) public class SocketAppender extends AbstractOutputStreamAppender<AbstractSocketManager>
LifeCycle.State
LOGGER
Modifier | Constructor and Description |
---|---|
protected |
SocketAppender(String name,
Layout<? extends Serializable> layout,
Filter filter,
AbstractSocketManager manager,
boolean ignoreExceptions,
boolean immediateFlush,
Advertiser advertiser) |
Modifier and Type | Method and Description |
---|---|
static SocketAppender |
createAppender(String host,
int port,
Protocol protocol,
SslConfiguration sslConfig,
int connectTimeoutMillis,
int reconnectDelayMillis,
boolean immediateFail,
String name,
boolean immediateFlush,
boolean ignoreExceptions,
Layout<? extends Serializable> layout,
Filter filter,
boolean advertise,
Configuration config)
Creates a socket appender.
|
static SocketAppender |
createAppender(String host,
String portNum,
String protocolIn,
SslConfiguration sslConfig,
int connectTimeoutMillis,
String delayMillis,
String immediateFail,
String name,
String immediateFlush,
String ignore,
Layout<? extends Serializable> layout,
Filter filter,
String advertise,
Configuration config)
Deprecated.
Use
#createAppender(String, String, Protocol, SslConfiguration, int, String, String, String, String, String, Layout, Filter, String, Configuration) . |
protected static AbstractSocketManager |
createSocketManager(String name,
Protocol protocol,
String host,
int port,
int connectTimeoutMillis,
SslConfiguration sslConfig,
int delayMillis,
boolean immediateFail,
Layout<? extends Serializable> layout)
Creates an AbstractSocketManager for TCP, UDP, and SSL.
|
void |
stop()
Cleanup the Filter.
|
append, getImmediateFlush, getManager, start
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
addFilter, getFilter, hasFilter, isFiltered, removeFilter
equalsImpl, getState, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getState, initialize, isStarted, isStopped
protected SocketAppender(String name, Layout<? extends Serializable> layout, Filter filter, AbstractSocketManager manager, boolean ignoreExceptions, boolean immediateFlush, Advertiser advertiser)
public void stop()
AbstractFilterable
stop
in interface LifeCycle
stop
in class AbstractOutputStreamAppender<AbstractSocketManager>
@PluginFactory public static SocketAppender createAppender(@PluginAttribute(value="host") String host, @PluginAttribute(value="port",defaultInt=0) int port, @PluginAttribute(value="protocol") Protocol protocol, @PluginElement(value="SSL") SslConfiguration sslConfig, @PluginAttribute(value="connectTimeoutMillis",defaultInt=0) int connectTimeoutMillis, @PluginAliases(value="reconnectionDelay") @PluginAttribute(value="reconnectionDelayMillis",defaultInt=0) int reconnectDelayMillis, @PluginAttribute(value="immediateFail",defaultBoolean=true) boolean immediateFail, @PluginAttribute(value="name") String name, @PluginAttribute(value="immediateFlush",defaultBoolean=true) boolean immediateFlush, @PluginAttribute(value="ignoreExceptions",defaultBoolean=true) boolean ignoreExceptions, @PluginElement(value="Layout") Layout<? extends Serializable> layout, @PluginElement(value="Filter") Filter filter, @PluginAttribute(value="advertise",defaultBoolean=false) boolean advertise, @PluginConfiguration Configuration config)
host
- The name of the host to connect to.port
- The port to connect to on the target host.protocol
- The Protocol to use.sslConfig
- The SSL configuration file for TCP/SSL, ignored for UPD.connectTimeoutMillis
- the connect timeout in milliseconds.reconnectDelayMillis
- The interval in which failed writes should be retried.immediateFail
- True if the write should fail if no socket is immediately available.name
- The name of the Appender.immediateFlush
- "true" if data should be flushed on each write.ignoreExceptions
- If "true"
(default) exceptions encountered when appending events are logged; otherwise they
are propagated to the caller.layout
- The layout to use (defaults to SerializedLayout).filter
- The Filter or null.advertise
- "true" if the appender configuration should be advertised, "false" otherwise.config
- The Configuration@Deprecated public static SocketAppender createAppender(String host, String portNum, String protocolIn, SslConfiguration sslConfig, int connectTimeoutMillis, String delayMillis, String immediateFail, String name, String immediateFlush, String ignore, Layout<? extends Serializable> layout, Filter filter, String advertise, Configuration config)
#createAppender(String, String, Protocol, SslConfiguration, int, String, String, String, String, String, Layout, Filter, String, Configuration)
.host
- The name of the host to connect to.portNum
- The port to connect to on the target host.protocolIn
- The Protocol to use.sslConfig
- The SSL configuration file for TCP/SSL, ignored for UPD.connectTimeoutMillis
- the connect timeout in milliseconds.delayMillis
- The interval in which failed writes should be retried.immediateFail
- True if the write should fail if no socket is immediately available.name
- The name of the Appender.immediateFlush
- "true" if data should be flushed on each write.ignore
- If "true"
(default) exceptions encountered when appending events are logged; otherwise they
are propagated to the caller.layout
- The layout to use (defaults to SerializedLayout).filter
- The Filter or null.advertise
- "true" if the appender configuration should be advertised, "false" otherwise.config
- The Configurationprotected static AbstractSocketManager createSocketManager(String name, Protocol protocol, String host, int port, int connectTimeoutMillis, SslConfiguration sslConfig, int delayMillis, boolean immediateFail, Layout<? extends Serializable> layout)
IllegalArgumentException
- if the protocol cannot be handled.Copyright © 1999-2017 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.