org.apache.logging.log4j.core.appender
Class SyslogAppender

java.lang.Object
  extended by org.apache.logging.log4j.core.AbstractLifeCycle
      extended by org.apache.logging.log4j.core.filter.AbstractFilterable
          extended by org.apache.logging.log4j.core.appender.AbstractAppender
              extended by org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender<AbstractSocketManager>
                  extended by org.apache.logging.log4j.core.appender.SocketAppender
                      extended by org.apache.logging.log4j.core.appender.SyslogAppender
All Implemented Interfaces:
Serializable, Appender, Filterable, LifeCycle

@Plugin(name="Syslog",
        category="Core",
        elementType="appender",
        printObject=true)
public class SyslogAppender
extends SocketAppender

The Syslog Appender.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
 
Field Summary
protected static String RFC5424
           
 
Fields inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
immediateFlush
 
Fields inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
LOGGER
 
Constructor Summary
protected SyslogAppender(String name, Layout<? extends Serializable> layout, Filter filter, boolean ignoreExceptions, boolean immediateFlush, AbstractSocketManager manager, Advertiser advertiser)
           
 
Method Summary
static SyslogAppender createAppender(String host, int port, String protocolStr, SslConfiguration sslConfig, int reconnectionDelayMillis, boolean immediateFail, String name, boolean immediateFlush, boolean ignoreExceptions, Facility facility, String id, int enterpriseNumber, boolean includeMdc, String mdcId, String mdcPrefix, String eventPrefix, boolean newLine, String escapeNL, String appName, String msgId, String excludes, String includes, String required, String format, Filter filter, Configuration config, Charset charsetName, String exceptionPattern, LoggerFields[] loggerFields, boolean advertise)
          Create a SyslogAppender.
 
Methods inherited from class org.apache.logging.log4j.core.appender.SocketAppender
createAppender, createSocketManager, stop
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender
append, getManager, start
 
Methods inherited from class org.apache.logging.log4j.core.appender.AbstractAppender
error, error, error, getHandler, getLayout, getName, ignoreExceptions, parseInt, setHandler, toString
 
Methods inherited from class org.apache.logging.log4j.core.filter.AbstractFilterable
addFilter, getFilter, hasFilter, isFiltered, removeFilter
 
Methods inherited from class org.apache.logging.log4j.core.AbstractLifeCycle
equals, getState, hashCode, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.logging.log4j.core.LifeCycle
isStarted, isStopped
 

Field Detail

RFC5424

protected static final String RFC5424
See Also:
Constant Field Values
Constructor Detail

SyslogAppender

protected SyslogAppender(String name,
                         Layout<? extends Serializable> layout,
                         Filter filter,
                         boolean ignoreExceptions,
                         boolean immediateFlush,
                         AbstractSocketManager manager,
                         Advertiser advertiser)
Method Detail

createAppender

@PluginFactory
public static SyslogAppender createAppender(@PluginAttribute(value="host")
                                                          String host,
                                                          @PluginAttribute(value="port",defaultInt=0)
                                                          int port,
                                                          @PluginAttribute(value="protocol")
                                                          String protocolStr,
                                                          @PluginElement(value="SSL")
                                                          SslConfiguration sslConfig,
                                                          @PluginAliases(value="reconnectionDelay")@PluginAttribute(value="reconnectionDelayMillis",defaultInt=0)
                                                          int reconnectionDelayMillis,
                                                          @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,
                                                          @PluginAttribute(value="facility",defaultString="LOCAL0")
                                                          Facility facility,
                                                          @PluginAttribute(value="id")
                                                          String id,
                                                          @PluginAttribute(value="enterpriseNumber",defaultInt=18060)
                                                          int enterpriseNumber,
                                                          @PluginAttribute(value="includeMdc",defaultBoolean=true)
                                                          boolean includeMdc,
                                                          @PluginAttribute(value="mdcId")
                                                          String mdcId,
                                                          @PluginAttribute(value="mdcPrefix")
                                                          String mdcPrefix,
                                                          @PluginAttribute(value="eventPrefix")
                                                          String eventPrefix,
                                                          @PluginAttribute(value="newLine",defaultBoolean=false)
                                                          boolean newLine,
                                                          @PluginAttribute(value="newLineEscape")
                                                          String escapeNL,
                                                          @PluginAttribute(value="appName")
                                                          String appName,
                                                          @PluginAttribute(value="messageId")
                                                          String msgId,
                                                          @PluginAttribute(value="mdcExcludes")
                                                          String excludes,
                                                          @PluginAttribute(value="mdcIncludes")
                                                          String includes,
                                                          @PluginAttribute(value="mdcRequired")
                                                          String required,
                                                          @PluginAttribute(value="format")
                                                          String format,
                                                          @PluginElement(value="Filter")
                                                          Filter filter,
                                                          @PluginConfiguration
                                                          Configuration config,
                                                          @PluginAttribute(value="charset",defaultString="UTF-8")
                                                          Charset charsetName,
                                                          @PluginAttribute(value="exceptionPattern")
                                                          String exceptionPattern,
                                                          @PluginElement(value="LoggerFields")
                                                          LoggerFields[] loggerFields,
                                                          @PluginAttribute(value="advertise",defaultBoolean=false)
                                                          boolean advertise)
Create a SyslogAppender.

Parameters:
host - The name of the host to connect to.
port - The port to connect to on the target host.
protocolStr - The Protocol to use.
sslConfig - TODO
reconnectionDelayMillis - 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.
facility - The Facility is used to try to classify the message.
id - The default structured data id to use when formatting according to RFC 5424.
enterpriseNumber - The IANA enterprise number.
includeMdc - Indicates whether data from the ThreadContextMap will be included in the RFC 5424 Syslog record. Defaults to "true:.
mdcId - The id to use for the MDC Structured Data Element.
mdcPrefix - The prefix to add to MDC key names.
eventPrefix - The prefix to add to event key names.
newLine - If true, a newline will be appended to the end of the syslog record. The default is false.
escapeNL - String that should be used to replace newlines within the message text.
appName - The value to use as the APP-NAME in the RFC 5424 syslog record.
msgId - The default value to be used in the MSGID field of RFC 5424 syslog records.
excludes - A comma separated list of mdc keys that should be excluded from the LogEvent.
includes - A comma separated list of mdc keys that should be included in the FlumeEvent.
required - A comma separated list of mdc keys that must be present in the MDC.
format - If set to "RFC5424" the data will be formatted in accordance with RFC 5424. Otherwise, it will be formatted as a BSD Syslog record.
filter - A Filter to determine if the event should be handled by this Appender.
config - The Configuration.
charsetName - The character set to use when converting the syslog String to a byte array.
exceptionPattern - The converter pattern to use for formatting exceptions.
loggerFields - The logger fields
advertise - Whether to advertise
Returns:
A SyslogAppender.


Copyright © 1999-2014 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.