Package ch.qos.logback.classic.net

# Class SyslogAppender

java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.AppenderBase<E>
ch.qos.logback.core.net.SyslogAppenderBase<ILoggingEvent>
ch.qos.logback.classic.net.SyslogAppender

All Implemented Interfaces:
  `Appender<ILoggingEvent>`, `ContextAware`, `FilterAttachable<ILoggingEvent>`, `LifeCycle`

public class SyslogAppender extends SyslogAppenderBase<ILoggingEvent>
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

Author:
  Ceki Gülcü

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`DEFAULT_STACKTRACE_PATTERN`
`static final String`
`DEFAULT_SUFFIX_PATTERN`

### 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
Constructor
Description
`SyslogAppender()`

## Method Summary

Modifier and Type
Method
Description
`Layout<ILoggingEvent>`
`buildLayout()`
`SyslogOutputStream`
`createOutputStream()`
`int`
`getSeverityForEvent(Object eventObject)`
Convert a level to equivalent syslog severity.
`String`
`getStackTracePattern()`
See {@link #setStackTracePattern(String).
`boolean`
`isThrowableExcluded()`
`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 of `SyslogAppenderBase.suffixPattern`.
`void`
`setThrowableExcluded(boolean throwableExcluded)`
Setting throwableExcluded to true causes no Throwable's stack trace data to be sent to the syslog daemon.
`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

public static final String DEFAULT_SUFFIX_PATTERN

See Also:
  - Constant Field Values

### DEFAULT_STACKTRACE_PATTERN

public static final String DEFAULT_STACKTRACE_PATTERN

See Also:
  - Constant Field Values

## Constructor Details

### SyslogAppender

public SyslogAppender()

## Method Details

### start

public void start()

Specified by:
  `start` in interface `LifeCycle`
Overrides:
  `start` in class `SyslogAppenderBase<ILoggingEvent>`

### createOutputStream

public SyslogOutputStream createOutputStream() throws SocketException, UnknownHostException

Specified by:
  `createOutputStream` in class `SyslogAppenderBase<ILoggingEvent>`
Throws:
  `SocketException`
  `UnknownHostException`

### getSeverityForEvent

public int getSeverityForEvent(Object eventObject)
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 class `SyslogAppenderBase<ILoggingEvent>`
See Also:
  - `SyslogAppenderBase.getSeverityForEvent(java.lang.Object)`

### postProcess

protected void postProcess(Object eventObject, OutputStream sw)

Overrides:
  `postProcess` in class `SyslogAppenderBase<ILoggingEvent>`

### buildLayout

public Layout<ILoggingEvent> buildLayout()

Specified by:
  `buildLayout` in class `SyslogAppenderBase<ILoggingEvent>`

### 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

public String getStackTracePattern()
See {@link #setStackTracePattern(String).

Returns:
  the stackTraceSuffixPattern
Since:
  1.0.4

### setStackTracePattern

public 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 of `SyslogAppenderBase.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