File: yamlconfigurator [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.

# Configuring Log4r with Log4r::YamlConfigurator

The YamlConfigurator class allows one to set up Log4r via YAML. It is used almost exactly as Log4r::Configurator and has the same features,

    ycfg = YamlConfigurator    # handy shorthand
    ycfg['foo'] = bar          # replaces instances of #{foo} in the YAML with bar
    ycfg.load_yaml_file('foo.yaml')

Ruby 1.7 and 1.8 comes with a YAML parser. Hence, YAML can be used to configure Log4r out of the box.

A comprehensive example of a Log4r YAML configuration is provided in the examples directory.

To use this class:

    require 'log4r/yamlconfigurator'

Thanks to Andreas Hund for making this possible.

[Validate]

Generated with the Darkfish Rdoc Generator 2.