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

# Formatters

Formatters are responsible for formatting LogEvent data. An Outputter owning a Formatter will invoke the Log4r::Formatter#format method prior to writing.

## Available Formatters

- Log4r::BasicFormatter - default

- Log4r::PatternFormatter - most flexible. See log4r/formatter/patternformatter.rb

- Log4r::SimpleFormatter - like BasicFormatter for Strings only (low noise)

- Log4r::ObjectFormatter - for inspecting objects

- Log4r::NullFormatter - twirls on its feet and does nothing

# XML Configuration

Specify the Formatter and its class (as `type`) under an `<outputter>` directive:

    <outputter name="someout" type="sometype">
      <formatter type="Log4r::BasicFormatter"/>
    </outputter>

As explained in log4r/configurator.rb, the hash arguments you would normally pass to `new` are specified as XML parameters. Only PatternFormatter has any of these.

# Custom Formatting

Building a custom Formatter is extremely easy. Just define a class that extends Formatter and override the Formatter#format method. Then give it to any interested Outputters.

If you're interested in setting up your custom formatters in XML, please take a look at log4r/configurator.rb.

## Data Available

See Log4r::LogEvent

[Validate]

Generated with the Darkfish Rdoc Generator 2.