Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.logging.log4j.core.layout
Class SyslogLayout

    java.lang.Object
      org.apache.logging.log4j.core.layout.AbstractLayout<String>
          org.apache.logging.log4j.core.layout.AbstractStringLayout
              org.apache.logging.log4j.core.layout.SyslogLayout

All Implemented Interfaces:
  Serializable, Layout<String>

    @Plugin(name="SyslogLayout",
            category="Core",
            elementType="layout",
            printObject=true)
    public final class SyslogLayout

extends AbstractStringLayout

Formats a log event as a BSD Log record.

See Also:
  Serialized Form

Field Summary
`static Pattern` | `NEWLINE_PATTERN` Match newlines in a platform-independent manner.

Fields inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
`footer, header, LOGGER`

Fields inherited from interface org.apache.logging.log4j.core.Layout
`ELEMENT_TYPE`

Constructor Summary
`protected` | `SyslogLayout(Facility facility, boolean includeNL, String escapeNL, Charset charset)`

Method Summary
`static SyslogLayout` | `createLayout(Facility facility, boolean includeNewLine, String escapeNL, Charset charset)` Create a SyslogLayout.
`Map<String,String>` | `getContentFormat()` Gets this SyslogLayout's content format.
`String` | `toSerializable(LogEvent event)` Formats a `LogEvent` in conformance with the BSD Log record format.

Methods inherited from class org.apache.logging.log4j.core.layout.AbstractStringLayout
`getBytes, getCharset, getContentType, toByteArray`

Methods inherited from class org.apache.logging.log4j.core.layout.AbstractLayout
`getFooter, getHeader`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NEWLINE_PATTERN

    public static final Pattern NEWLINE_PATTERN

  Match newlines in a platform-independent manner.

Constructor Detail

### SyslogLayout

    protected SyslogLayout(Facility facility,
                           boolean includeNL,
                           String escapeNL,
                           Charset charset)

Method Detail

### toSerializable

    public String toSerializable(LogEvent event)

  Formats a `LogEvent` in conformance with the BSD Log record format.

  Parameters:
    `event` - The LogEvent
  Returns:
    the event formatted as a String.

### getContentFormat

    public Map<String,String> getContentFormat()

  Gets this SyslogLayout's content format. Specified by:
  - Key: "structured" Value: "false"
  - Key: "dateFormat" Value: "MMM dd HH:mm:ss"
  - Key: "format" Value: "<LEVEL>TIMESTAMP PROP(HOSTNAME) MESSAGE"
  - Key: "formatType" Value: "logfilepatternreceiver" (format uses the keywords supported by LogFilePatternReceiver)

  Specified by:
    `getContentFormat` in interface `Layout<String>`
  Overrides:
    `getContentFormat` in class `AbstractLayout<String>`
  Returns:
    Map of content format keys supporting SyslogLayout

### createLayout

    @PluginFactory
    public static SyslogLayout createLayout(@PluginAttribute(value="facility",defaultString="LOCAL0")
                                                          Facility facility,
                                                          @PluginAttribute(value="newLine",defaultBoolean=false)
                                                          boolean includeNewLine,
                                                          @PluginAttribute(value="newLineEscape")
                                                          String escapeNL,
                                                          @PluginAttribute(value="charset",defaultString="UTF-8")
                                                          Charset charset)

  Create a SyslogLayout.

  Parameters:
    `facility` - The Facility is used to try to classify the message.
    `includeNewLine` - If true a newline will be appended to the result.
    `escapeNL` - Pattern to use for replacing newlines.
    `charset` - The character set.
  Returns:
    A SyslogLayout.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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