Package ch.qos.logback.classic.net
Class SyslogAppender
java.lang.Object
- All Implemented Interfaces:
Appender<ILoggingEvent>
,ContextAware
,FilterAttachable<ILoggingEvent>
,LifeCycle
This appender can be used to send messages to a remote syslog daemon.
For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#SyslogAppender
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
(package private) PatternLayout
(package private) String
(package private) boolean
Fields inherited from class ch.qos.logback.core.net.SyslogAppenderBase
suffixPattern
Fields inherited from class ch.qos.logback.core.AppenderBase
name, started
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) String
int
getSeverityForEvent
(Object eventObject) Convert a level to equivalent syslog severity.Seeinvalid @link
{@link #setStackTracePattern(String).
private void
handleThrowableFirstLine
(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) boolean
protected void
postProcess
(Object eventObject, OutputStream sw) void
setStackTracePattern
(String stackTracePattern) Stack trace lines are sent to the syslog server separately from the main message For stack trace lines, the stackTracePattern is used instead ofSyslogAppenderBase.suffixPattern
.void
setThrowableExcluded
(boolean throwableExcluded) Setting throwableExcluded to true causes no Throwable's stack trace data to be sent to the syslog daemon.private void
(package private) boolean
stackTraceHeaderLine
(StringBuilder sb, boolean topException) void
start()
Methods inherited from class ch.qos.logback.core.net.SyslogAppenderBase
append, facilityStringToint, getCharset, getFacility, getLayout, getMaxMessageSize, getPort, getSuffixPattern, getSyslogHost, setCharset, setFacility, setLayout, setMaxMessageSize, setPort, setSuffixPattern, setSyslogHost, 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
-
DEFAULT_SUFFIX_PATTERN
- See Also:
-
DEFAULT_STACKTRACE_PATTERN
- See Also:
-
stackTraceLayout
PatternLayout stackTraceLayout -
stackTracePattern
String stackTracePattern -
throwableExcluded
boolean throwableExcluded
-
-
Constructor Details
-
SyslogAppender
public SyslogAppender()
-
-
Method Details
-
start
public void start()- Specified by:
start
in interfaceLifeCycle
- Overrides:
start
in classSyslogAppenderBase<ILoggingEvent>
-
getPrefixPattern
String getPrefixPattern() -
createOutputStream
- Specified by:
createOutputStream
in classSyslogAppenderBase<ILoggingEvent>
- Throws:
SocketException
UnknownHostException
-
getSeverityForEvent
Convert a level to equivalent syslog severity. Only levels for printing methods i.e DEBUG, WARN, INFO and ERROR are converted.- Specified by:
getSeverityForEvent
in classSyslogAppenderBase<ILoggingEvent>
- See Also:
-
postProcess
- Overrides:
postProcess
in classSyslogAppenderBase<ILoggingEvent>
-
handleThrowableFirstLine
private void handleThrowableFirstLine(OutputStream sw, IThrowableProxy tp, String stackTracePrefix, boolean isRootException) throws IOException - Throws:
IOException
-
stackTraceHeaderLine
-
buildLayout
- Specified by:
buildLayout
in classSyslogAppenderBase<ILoggingEvent>
-
setupStackTraceLayout
private void setupStackTraceLayout() -
isThrowableExcluded
public boolean isThrowableExcluded() -
setThrowableExcluded
public void setThrowableExcluded(boolean throwableExcluded) Setting throwableExcluded to true causes no Throwable's stack trace data to be sent to the syslog daemon. By default, stack trace data is sent to syslog daemon.- Parameters:
throwableExcluded
-- Since:
- 1.0.4
-
getStackTracePattern
Seeinvalid @link
{@link #setStackTracePattern(String).
- Returns:
- the stackTraceSuffixPattern
- Since:
- 1.0.4
-
setStackTracePattern
Stack trace lines are sent to the syslog server separately from the main message For stack trace lines, the stackTracePattern is used instead ofSyslogAppenderBase.suffixPattern
. The stackTracePattern option allows specification of a separately format for the non-standardized part of stack trace lines.- Parameters:
stackTracePattern
-- Since:
- 1.0.4
-