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
`static java.lang.String` `DEFAULT_STACKTRACE_PATTERN`
`static java.lang.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
`SyslogAppender()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Layout<ILoggingEvent>` `buildLayout()`
`SyslogOutputStream` `createOutputStream()`
`int` `getSeverityForEvent​(java.lang.Object eventObject)` Convert a level to equivalent syslog severity.
`java.lang.String` `getStackTracePattern()` See {@link #setStackTracePattern(String).
`boolean` `isThrowableExcluded()`
`protected void` `postProcess​(java.lang.Object eventObject, java.io.OutputStream sw)`
`void` `setStackTracePattern​(java.lang.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 Detail

#### DEFAULT_SUFFIX_PATTERN

    public static final java.lang.String DEFAULT_SUFFIX_PATTERN

See Also:
  Constant Field Values

#### DEFAULT_STACKTRACE_PATTERN

    public static final java.lang.String DEFAULT_STACKTRACE_PATTERN

See Also:
  Constant Field Values

### Constructor Detail

#### SyslogAppender

    public SyslogAppender()

### Method Detail

#### start

    public void start()

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

#### createOutputStream

    public SyslogOutputStream createOutputStream()
                                          throws java.net.SocketException,
                                                 java.net.UnknownHostException

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

#### getSeverityForEvent

    public int getSeverityForEvent​(java.lang.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​(java.lang.Object eventObject,
                               java.io.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 java.lang.String getStackTracePattern()

See {@link #setStackTracePattern(String).

Returns:
  the stackTraceSuffixPattern
Since:
  1.0.4

#### setStackTracePattern

    public void setStackTracePattern​(java.lang.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