File: syslogoutputter [log4r-1.1.10 Documentation]

### Home Classes Methods

### Files

- GDC
- MDC
- NDC
- configurator
- emailoutputter
- formatter
- log4jxmlformatter
- log4r
- logger
- logserver
- outputter
- patternformatter
- scribeoutputter
- syslogoutputter
- win32eventoutputter
- yamlconfigurator

### Class Index

Quicksearch

- Log4r
- Log4r::BasicFormatter
- Log4r::ConfigError
- Log4r::Configurator
- Log4r::DateFileOutputter
- Log4r::DefaultFormatter
- Log4r::EmailOutputter
- Log4r::FileOutputter
- Log4r::Formatter
- Log4r::GDC
- Log4r::IOOutputter
- Log4r::Log4jXmlFormatter
- Log4r::Log4rTools
- Log4r::LogEvent
- Log4r::LogServer
- Log4r::Logger
- Log4r::MDC
- Log4r::NDC
- Log4r::ObjectFormatter
- Log4r::Outputter
- Log4r::PatternFormatter
- Log4r::RemoteOutputter
- Log4r::RollingFileOutputter
- Log4r::RootLogger
- Log4r::ScribeOutputter
- Log4r::SimpleFormatter
- Log4r::StderrOutputter
- Log4r::StdoutOutputter
- Log4r::SyslogOutputter
- Log4r::UDPOutputter
- Log4r::YamlConfigurator
- REXML
- Object

No matching classes.

# SyslogOutputter

A SyslogOutputter transforms a Log4r::LogEvent into a call to syslog(). Since syslog has its own formatting system, log4r formatters are ignored.

## Usage

To use,

    <tt>require 'log4r/outputter/syslogoutputter'</tt>

An example,

    require 'log4r'
    require 'log4r/outputter/syslogoutputter'

    syslog = Log4r::SyslogOutputter.new("name", 'logopt'=>#, 'facility'=>#)
    syslog.err("this is an ERR message")

The output in `/var/logs/syslog` (Debian) is,

    Sep  3 11:43:06 tiphares sys[1603]: this is an ERR message

The hash arguments `logoptions` and `facility` are passed to `Syslog.open`. The defaults are `LOG_PID | LOG_CONS` and `LOG_USER` respectively.

This is a first try implementation. It works well. Please report any bugs and fixes.

[Validate]

Generated with the Darkfish Rdoc Generator 2.