@Plugin(name="Socket", category="Core", elementType="appender", printObject=true) public class SocketAppender extends AbstractOutputStreamAppender<AbstractSocketManager>
LifeCycle.State
immediateFlush
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, 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,
String portNum,
String protocolStr,
SslConfiguration sslConfig,
int connectTimeoutMillis,
String delayMillis,
String immediateFail,
String name,
String immediateFlush,
String ignore,
Layout<? extends Serializable> layout,
Filter filter,
String advertise,
Configuration config) |
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, getManager, start
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
addFilter, getFilter, hasFilter, isFiltered, removeFilter
equalsImpl, getState, hashCodeImpl, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
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") String portNum, @PluginAttribute(value="protocol") String protocolStr, @PluginElement(value="SSL") SslConfiguration sslConfig, @PluginAttribute(value="connectTimeoutMillis",defaultInt=0) int connectTimeoutMillis, @PluginAliases(value="reconnectionDelay") @PluginAttribute(value="reconnectionDelayMillis") String delayMillis, @PluginAttribute(value="immediateFail") String immediateFail, @PluginAttribute(value="name") String name, @PluginAttribute(value="immediateFlush") String immediateFlush, @PluginAttribute(value="ignoreExceptions") String ignore, @PluginElement(value="Layout") Layout<? extends Serializable> layout, @PluginElement(value="Filter") Filter filter, @PluginAttribute(value="advertise") String advertise, @PluginConfiguration Configuration config)
host
- The name of the host to connect to.portNum
- The port to connect to on the target host.protocolStr
- 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-2021 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.