@Plugin(name="Socket", category="Core", elementType="appender", printObject=true) public class SocketAppender extends AbstractOutputStreamAppender<AbstractSocketManager>
Modifier and Type | Class and Description |
---|---|
static class |
SocketAppender.AbstractBuilder<B extends SocketAppender.AbstractBuilder<B>>
Subclasses can extend this abstract Builder.
|
static class |
SocketAppender.Builder
Builds a SocketAppender.
|
LifeCycle.State
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
ELEMENT_TYPE
Modifier | Constructor and Description |
---|---|
protected |
SocketAppender(String name,
Layout<? extends Serializable> layout,
Filter filter,
AbstractSocketManager manager,
boolean ignoreExceptions,
boolean immediateFlush,
Advertiser advertiser)
|
protected |
SocketAppender(String name,
Layout<? extends Serializable> layout,
Filter filter,
AbstractSocketManager manager,
boolean ignoreExceptions,
boolean immediateFlush,
Advertiser advertiser,
Property[] properties) |
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 configuration)
Deprecated.
Deprecated in 2.7; use
newBuilder() |
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.
Deprecated in 2.5; use
newBuilder() |
protected static AbstractSocketManager |
createSocketManager(String name,
Protocol protocol,
String host,
int port,
int connectTimeoutMillis,
SslConfiguration sslConfig,
int reconnectDelayMillis,
boolean immediateFail,
Layout<? extends Serializable> layout,
int bufferSize)
|
protected static AbstractSocketManager |
createSocketManager(String name,
Protocol protocol,
String host,
int port,
int connectTimeoutMillis,
SslConfiguration sslConfig,
int reconnectDelayMillis,
boolean immediateFail,
Layout<? extends Serializable> layout,
int bufferSize,
SocketOptions socketOptions)
Creates an AbstractSocketManager for TCP, UDP, and SSL.
|
protected void |
directEncodeEvent(LogEvent event) |
static SocketAppender.Builder |
newBuilder() |
boolean |
stop(long timeout,
TimeUnit timeUnit)
Cleanup the Filter.
|
append, getImmediateFlush, getManager, start, stop, writeByteArrayToManager
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, requiresLocation, setHandler, toSerializable, toString
addFilter, getFilter, getPropertyArray, hasFilter, isFiltered, removeFilter
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, stop, stop
protected SocketAppender(String name, Layout<? extends Serializable> layout, Filter filter, AbstractSocketManager manager, boolean ignoreExceptions, boolean immediateFlush, Advertiser advertiser, Property[] properties)
@Deprecated protected SocketAppender(String name, Layout<? extends Serializable> layout, Filter filter, AbstractSocketManager manager, boolean ignoreExceptions, boolean immediateFlush, Advertiser advertiser)
@PluginBuilderFactory public static SocketAppender.Builder newBuilder()
public boolean stop(long timeout, TimeUnit timeUnit)
AbstractFilterable
stop
in interface LifeCycle2
stop
in class AbstractOutputStreamAppender<AbstractSocketManager>
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argument@Deprecated @PluginFactory public 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 configuration)
newBuilder()
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. Required, there is no default.filter
- The Filter or null.advertise
- "true" if the appender configuration should be advertised, "false" otherwise.configuration
- 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)
newBuilder()
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. Required, there is no default.filter
- The Filter or null.advertise
- "true" if the appender configuration should be advertised, "false" otherwise.config
- The Configuration@Deprecated protected static AbstractSocketManager createSocketManager(String name, Protocol protocol, String host, int port, int connectTimeoutMillis, SslConfiguration sslConfig, int reconnectDelayMillis, boolean immediateFail, Layout<? extends Serializable> layout, int bufferSize)
createSocketManager(String, Protocol, String, int, int, SslConfiguration, int, boolean, Layout, int, SocketOptions)
.IllegalArgumentException
- if the protocol cannot be handled.protected static AbstractSocketManager createSocketManager(String name, Protocol protocol, String host, int port, int connectTimeoutMillis, SslConfiguration sslConfig, int reconnectDelayMillis, boolean immediateFail, Layout<? extends Serializable> layout, int bufferSize, SocketOptions socketOptions)
IllegalArgumentException
- if the protocol cannot be handled.protected void directEncodeEvent(LogEvent event)
directEncodeEvent
in class AbstractOutputStreamAppender<AbstractSocketManager>
Copyright © 1999-2021 The 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.