public abstract class AbstractLogstashTcpSocketAppender<Event extends ch.qos.logback.core.spi.DeferredProcessingAware> extends AsyncDisruptorAppender<Event>
AsyncDisruptorAppender appender that writes
events to a TCP Socket outputStream.
The behavior is similar to a ch.qos.logback.classic.net.SocketAppender, except that:
RingBuffer instead of a BlockingQueueEncoder instead of serialization
In addition, SSL can be enabled by setting the SSL configuration via setSsl(SSLConfiguration).
See the logback manual
for details on how to configure client-side SSL.
AsyncDisruptorAppender.LogEvent<Event>, AsyncDisruptorAppender.LogEventTranslator<Event>| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_CONNECTION_TIMEOUT
Default timeout when waiting for the remote server to accept our
connection.
|
static int |
DEFAULT_PORT
The default port number of remote logging server (4560).
|
static int |
DEFAULT_QUEUE_SIZE
Default size of the queue used to hold logging events that are destined
for the remote peer.
|
static int |
DEFAULT_RECONNECTION_DELAY
The default reconnection delay (30000 milliseconds or 30 seconds).
|
static int |
DEFAULT_WRITE_BUFFER_SIZE |
DEFAULT_DROPPED_WARN_FREQUENCY, DEFAULT_PRODUCER_TYPE, DEFAULT_RING_BUFFER_SIZE, DEFAULT_THREAD_NAME_PREFIX, DEFAULT_WAIT_STRATEGY| Constructor and Description |
|---|
AbstractLogstashTcpSocketAppender() |
| Modifier and Type | Method and Description |
|---|---|
ch.qos.logback.core.encoder.Encoder<Event> |
getEncoder() |
Charset |
getKeepAliveCharset() |
ch.qos.logback.core.util.Duration |
getKeepAliveDuration() |
String |
getKeepAliveMessage() |
int |
getPort() |
int |
getQueueSize()
Returns the maximum number of events in the queue.
|
ch.qos.logback.core.util.Duration |
getReconnectionDelay() |
String |
getRemoteHost() |
SocketFactory |
getSocketFactory() |
ch.qos.logback.core.net.ssl.SSLConfiguration |
getSsl() |
int |
getWriteBufferSize() |
boolean |
isKeepAliveEnabled() |
boolean |
isStarted() |
void |
setEncoder(ch.qos.logback.core.encoder.Encoder<Event> encoder) |
void |
setKeepAliveCharset(String keepAliveCharset)
The charset to use when writing the
keepAliveMessage. |
void |
setKeepAliveDuration(ch.qos.logback.core.util.Duration keepAliveDuration)
If this duration elapses without an event being sent,
then the
keepAliveMessage will be sent to the socket in
order to keep the connection alive. |
void |
setKeepAliveMessage(String keepAliveMessage)
Message to send for keeping the connection alive
if
keepAliveDuration is non-null. |
void |
setPort(int port)
The TCP port on the host to which to connect and send events
|
void |
setQueueSize(int queueSize)
Sets the maximum number of events in the queue.
|
void |
setReconnectionDelay(ch.qos.logback.core.util.Duration delay)
Time period for which to wait after a connection fails,
before attempting to reconnect.
|
void |
setRemoteHost(String host)
The host to which to connect and send events
|
void |
setSocketFactory(SocketFactory socketFactory)
Used to create client
Sockets to which to communicate. |
void |
setSsl(ch.qos.logback.core.net.ssl.SSLConfiguration sslConfiguration)
Set this to non-null to use SSL.
|
void |
setWriteBufferSize(int writeBufferSize)
The number of bytes available in the write buffer.
|
void |
start() |
void |
stop() |
append, getDisruptor, getDroppedWarnFrequency, getEventHandler, getEventTranslator, getExecutorService, getProducerType, getRingBufferSize, getThreadFactory, getThreadNamePrefix, getThreadPoolCoreSize, getWaitStrategy, isDaemon, prepareForDeferredProcessing, setDaemon, setDroppedWarnFrequency, setEventFactory, setEventHandler, setEventTranslator, setProducerType, setRingBufferSize, setThreadFactory, setThreadNamePrefix, setThreadPoolCoreSize, setWaitStrategy, setWaitStrategyTypeaddFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, setName, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextpublic static final int DEFAULT_PORT
public static final int DEFAULT_RECONNECTION_DELAY
public static final int DEFAULT_QUEUE_SIZE
public static final int DEFAULT_CONNECTION_TIMEOUT
public static final int DEFAULT_WRITE_BUFFER_SIZE
public boolean isStarted()
isStarted in interface ch.qos.logback.core.spi.LifeCycleisStarted in class ch.qos.logback.core.UnsynchronizedAppenderBase<Event extends ch.qos.logback.core.spi.DeferredProcessingAware>public void start()
start in interface ch.qos.logback.core.spi.LifeCyclestart in class AsyncDisruptorAppender<Event extends ch.qos.logback.core.spi.DeferredProcessingAware>public void stop()
stop in interface ch.qos.logback.core.spi.LifeCyclestop in class AsyncDisruptorAppender<Event extends ch.qos.logback.core.spi.DeferredProcessingAware>public ch.qos.logback.core.encoder.Encoder<Event> getEncoder()
public void setEncoder(ch.qos.logback.core.encoder.Encoder<Event> encoder)
public SocketFactory getSocketFactory()
public void setSocketFactory(SocketFactory socketFactory)
Sockets to which to communicate.
By default, it is the system default SocketFactory.public void setRemoteHost(String host)
public String getRemoteHost()
public void setPort(int port)
public int getPort()
public void setReconnectionDelay(ch.qos.logback.core.util.Duration delay)
public ch.qos.logback.core.util.Duration getReconnectionDelay()
public int getWriteBufferSize()
public void setWriteBufferSize(int writeBufferSize)
public int getQueueSize()
public void setQueueSize(int queueSize)
Must be a positive power of 2.
queueSize - the maximum number of entries in the queue.public ch.qos.logback.core.net.ssl.SSLConfiguration getSsl()
public void setSsl(ch.qos.logback.core.net.ssl.SSLConfiguration sslConfiguration)
public ch.qos.logback.core.util.Duration getKeepAliveDuration()
public void setKeepAliveDuration(ch.qos.logback.core.util.Duration keepAliveDuration)
keepAliveMessage will be sent to the socket in
order to keep the connection alive.
When null, no keepAlive messages will be sent.public String getKeepAliveMessage()
public void setKeepAliveMessage(String keepAliveMessage)
keepAliveDuration is non-null.
The following values have special meaning:
Any other value will be used as-is.
public boolean isKeepAliveEnabled()
public Charset getKeepAliveCharset()
public void setKeepAliveCharset(String keepAliveCharset)
keepAliveMessage.
Defaults to UTF-8.Copyright © 2015. All Rights Reserved.