<property name="host"value="localhost"/>
<property name="port"value="5000"/>
</slee-management>
<createsocketappender appendername="bar"properties="protocol=UDP,bufferedIO=true,immediateFlush=false,immediateFail=false,bufferSize=65536">
<propertyset>
<propertyref name="host"/>
<propertyref name="port"/>
</propertyset>
<component pluginname="filters">
<component pluginname="BurstFilter"properties="level=WARN,rate=50"/>
<component pluginname="BurstFilter"properties="level=INFO,rate=3"/>
<component pluginname="ThresholdFilter"properties="level=INFO"/>
</component>
<component pluginname="JsonLayout"properties="compact=false,complete=false,includeStacktrace=true,properties=true"/>
</createsocketappender>
</slee-management>
Class CreateSocketAppenderTask
- java.lang.Object
-
- com.opencloud.slee.mlet.ant.tasks.AbstractBaseTask
-
- com.opencloud.slee.mlet.ant.tasks.CreateGenericComponentTask
-
- com.opencloud.slee.mlet.ant.tasks.CreateAppenderTask
-
- com.opencloud.slee.mlet.ant.tasks.CreateOutputStreamAppenderTask
-
- com.opencloud.slee.mlet.ant.tasks.CreateSocketAppenderTask
-
- All Implemented Interfaces:
SubTask
public class CreateSocketAppenderTask extends CreateOutputStreamAppenderTask
A Rhino management sub task for creating a log socket appender.
Ant Parameters Attribute Type Description Required appendername
String
Name of the appender to create. This name must be unique.
Yes.
remotehost
String
Name or IP address of the remote host to connect to.
Yes.
port
int
Port on the remote host to connect to.
Yes.
protocol
String
"TCP" (default), "SSL" or "UDP".
No. If not specified, the default is TCP
immediatefail
boolean
When set to true, log events will not wait to try to reconnect and will fail immediately if the socket is not available.
Yes.
immediateflush
boolean
When set to true, each write will be followed by a flush. This will guarantee the data is written to the socket but could impact performance.
No. If not specified, defaults to true.
bufferedio
boolean
When true, events are written to a buffer and the data will be written to the socket when the buffer is full or, if immediateFlush is set, when the record is written.
No. If not specified, defaults to true.
buffersize
int
When bufferedIO is true, this is the buffer size, the default is 8192 bytes.
No.
reconnectiondelaymillis
int
If set to a value greater than 0, after an error the SocketManager will attempt to reconnect to the server after waiting the specified number of milliseconds. If the reconnect fails then an exception will be thrown (which can be caught by the application if ignoreExceptions is set to false).
No. If not specified, the default is 0
connecttimeoutmillis
int
The connect timeout in milliseconds. The default is 0 (infinite timeout, like Socket.connect() methods).
No.
keystorelocation
String
The location of the KeyStore which is used to create an SslConfiguration
No.
keystorepassword
String
The password to access the KeyStore.
No.
truststorelocation
String
The location of the TrustStore which is used to create an SslConfiguration
No.
truststorepassword
String
The password of the TrustStore
No.
ignoreexceptions
boolean
The default is true, causing exceptions encountered while appending events to be internally logged and then ignored. When set to false exceptions will be propagated to the caller, instead.
No.
failonerror
boolean
Flag to control failure behaviour. If 'true', the sub task will throw a
BuildException
when an error is encountered. If 'false', the sub task will throw aNonFatalBuildException
instead of aBuildException
under specific circumstances. See below for conditions (if any) which will cause aNonFatalBuildException
.No. Default value is taken from the Rhino management parent task.
Nested elements Element
Description
Required
filter
A filter to select events that will be reported by this appender.
No.
layout
The layout to use to format log events. If no layout is supplied the default pattern layout of "%m%n" will be used.
No.
NonFatalBuildException throw conditions-
This task will throw a
NonFatalBuildException
if the appender cannot be created, eg. an appender with the same name already exists.
This example creates a socket appender that sends JSON formatted log events to the host and port specified in the
host
andport
properties. It filters outgoing messages to a maximum of 3 INFO level messages per second and 50WARN
/Warning
messages. AllSevere
andERROR
messages are transmitted.This example requires that the three jackson library jars jackson-annotations-2.5.0.jar, jackson-core-2.5.0.jar and jackson-databind-2.5.0.jar be present in rhino/lib/logging-plugins/ NOTE: the
complete
configuration property of JsonLayout should always be set to the default value of false as setting it to true will produce malformed JSON on unclean shutdown and node restart requiring manual cleanup. Do not use this layout with file appenders as the written JSON will be invalid.To search the output of the appender "bar", use a tool such as jq
# Select all log entries for key "rhino" jq '.[] | select(.loggerName=="rhino")' < node-101/work/log/baz # Select all log entries for transaction ID 101:235885817027593 jq '.[] | select(.contextMap.txID=="101:235885817027593")' < node-101/work/log/baz
-
-
Field Summary
-
Fields inherited from class com.opencloud.slee.mlet.ant.tasks.CreateAppenderTask
appenderName
-
Fields inherited from class com.opencloud.slee.mlet.ant.tasks.CreateGenericComponentTask
components, properties
-
Fields inherited from class com.opencloud.slee.mlet.ant.tasks.AbstractBaseTask
client, failOnError
-
-
Constructor Summary
Constructors Constructor Description CreateSocketAppenderTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSsl(CreateGenericComponentTask ssl)
String
getPluginname()
void
setBufferedIO(Boolean bufferedIO)
void
setBufferSize(Integer bufferSize)
void
setConnectTimeoutMillis(Integer connectTimeoutMillis)
void
setIgnoreExceptions(Boolean ignoreExceptions)
void
setImmediateFail(Boolean immediateFail)
void
setImmediateFlush(Boolean immediateFlush)
void
setPort(Integer port)
void
setProtocol(String protocol)
void
setReconnectionDelayMillis(Integer reconnectionDelayMillis)
void
setRemoteHost(String remoteHost)
protected void
validateParameters()
-
Methods inherited from class com.opencloud.slee.mlet.ant.tasks.CreateOutputStreamAppenderTask
setImmediateFlush
-
Methods inherited from class com.opencloud.slee.mlet.ant.tasks.CreateAppenderTask
execute, setAppenderName
-
Methods inherited from class com.opencloud.slee.mlet.ant.tasks.CreateGenericComponentTask
addComponent, addPropertyNotNull, addPropertySet, allTrue, buildGenericComponentData, expandPropertySets, getComponents, getPropertiesArray, setPluginname, setProperties, validateHasProperty
-
Methods inherited from class com.opencloud.slee.mlet.ant.tasks.AbstractBaseTask
getExceptionAndMessage, getFailOnError, getMessage, getOverrideFailOnError, getParent, getProject, log, run, setFailOnError
-
-
-
-
Method Detail
-
validateParameters
protected void validateParameters() throws org.apache.tools.ant.BuildException
- Overrides:
validateParameters
in classCreateAppenderTask
- Throws:
org.apache.tools.ant.BuildException
-
getPluginname
public String getPluginname()
- Overrides:
getPluginname
in classCreateGenericComponentTask
-
setRemoteHost
public void setRemoteHost(String remoteHost)
-
setPort
public void setPort(Integer port)
-
setProtocol
public void setProtocol(String protocol)
-
setImmediateFail
public void setImmediateFail(Boolean immediateFail)
-
setImmediateFlush
public void setImmediateFlush(Boolean immediateFlush)
-
setBufferedIO
public void setBufferedIO(Boolean bufferedIO)
-
setBufferSize
public void setBufferSize(Integer bufferSize)
-
setReconnectionDelayMillis
public void setReconnectionDelayMillis(Integer reconnectionDelayMillis)
-
setConnectTimeoutMillis
public void setConnectTimeoutMillis(Integer connectTimeoutMillis)
-
setIgnoreExceptions
public void setIgnoreExceptions(Boolean ignoreExceptions)
- Overrides:
setIgnoreExceptions
in classCreateAppenderTask
-
addSsl
public void addSsl(CreateGenericComponentTask ssl)
-
-