java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<E>
ch.qos.logback.core.net.SyslogAppenderBase<E>
- Type Parameters:
E
-
- All Implemented Interfaces:
Appender<E>
,ContextAware
,FilterAttachable<E>
,LifeCycle
- Direct Known Subclasses:
SyslogAppender
Base class for SyslogAppender.
- Author:
- Ceki Gülcü
-
Field Summary
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
abstract SyslogOutputStream
static int
facilityStringToint
(String facilityStr) Returns the integer value corresponding to the named syslog facility.Returns the Charset used to encode String messages into byte sequences when writing to syslog.Returns the string value of the Facility option.int
int
getPort()
abstract int
getSeverityForEvent
(Object eventObject) Returns the value of the SyslogHost option.protected void
postProcess
(Object event, OutputStream sw) void
setCharset
(Charset charset) The Charset to use when encoding messages into byte sequences.void
setFacility
(String facilityStr) The Facility option must be set one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, NTP, AUDIT, ALERT, CLOCK, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7.void
void
setMaxMessageSize
(int maxMessageSize) Maximum size for the syslog message (in characters); messages longer than this are truncated.void
setPort
(int port) The port number on the syslog server to connect to.void
setSuffixPattern
(String suffixPattern) The suffixPattern option specifies the format of the non-standardized part of the message sent to the syslog server.void
setSyslogHost
(String syslogHost) The SyslogHost option is the name of the syslog host where log output should go.void
start()
void
stop()
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toString
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.qos.logback.core.spi.ContextAware
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext
-
Field Details
-
suffixPattern
-
-
Constructor Details
-
SyslogAppenderBase
public SyslogAppenderBase()
-
-
Method Details
-
start
- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classAppenderBase<E>
-
createOutputStream
public abstract SyslogOutputStream createOutputStream() throws UnknownHostException, SocketException- Throws:
UnknownHostException
SocketException
-
buildLayout
-
getSeverityForEvent
-
append
- Specified by:
append
in classAppenderBase<E>
-
postProcess
-
facilityStringToint
Returns the integer value corresponding to the named syslog facility.- Throws:
IllegalArgumentException
- if the facility string is not recognized
-
getSyslogHost
Returns the value of the SyslogHost option. -
setSyslogHost
The SyslogHost option is the name of the syslog host where log output should go. WARNING If the SyslogHost is not set, then this appender will fail. -
getFacility
Returns the string value of the Facility option. SeesetFacility(java.lang.String)
for the set of allowed values. -
setFacility
The Facility option must be set one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, NTP, AUDIT, ALERT, CLOCK, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. Case is not important.See
SyslogConstants
and RFC 3164 for more information about the Facility option. -
getPort
- Returns:
-
setPort
The port number on the syslog server to connect to. Normally, you would not want to change the default value, that is 514. -
getMaxMessageSize
-
setMaxMessageSize
Maximum size for the syslog message (in characters); messages longer than this are truncated. The default value is 65400 (which is near the maximum for syslog-over-UDP). Note that the value is characters; the number of bytes may vary if non-ASCII characters are present. -
getLayout
-
setLayout
-
stop
- Specified by:
stop
in interfaceLifeCycle
- Overrides:
stop
in classAppenderBase<E>
-
getSuffixPattern
- Returns:
-
setSuffixPattern
The suffixPattern option specifies the format of the non-standardized part of the message sent to the syslog server.- Parameters:
suffixPattern
-
-
getCharset
Returns the Charset used to encode String messages into byte sequences when writing to syslog. -
setCharset
The Charset to use when encoding messages into byte sequences.- Parameters:
charset
-
-