File
log4r.rb
Path: log4r.rb
Modified: Mon Aug 19 21:15:04 PDT 2002

1.0.5 Log4r API Reference

Welcome to the Log4r API reference. There are two classes of reference, the file overview and the class API. They are listed under Files and Classes respectively. File overviews cover the use of the Log4r API and some implementation details, whereas class APIs detail the methods available to the various objects.

The code examples in this API assume:

  include Log4r

This file overview covers some of the major concepts in Log4r.

Log Levels

Log4r provides as many levels of logging as desired. Logging levels are an ordered set of names ranked by priority. The more important a level is, the higher its priority and the more likely we want to see any data associated with it. Log4r provides many ways to filter information by level.

Loggers and Outputters have a level parameter which serves as a level threshold. Any data below this threshold will be ignored by the Logger or Outputter. Additionally, Outputters can be set to mask out any particular level or collection of levels.

By combining level thresholds with other Log4r features, one can direct any set of data to any destination desired in a way that is easy to visualize and configure.

Default Levels

The default log levels and their priority rankings are:

  DEBUG < INFO < WARN < ERROR < FATAL

Custom Levels

You can have as many levels as you desire, with any naming scheme. Log4r will automatically define level constants and log method names after your custom specification.

Please see log4r/configurator.rb for details.

Boundary Levels

There are two special levels, ALL and OFF which denote whether we are logging at all levels or at none. The priority ranks with respect to the logging levels are as follows:

  ALL < logging levels as defined by user < OFF

Thus, setting the level to ALL will enable logging at all levels whereas OFF will turn off logging completely.

File Overviews

For Loggers:log4r/logger.rb
For Outputters:log4r/outputter/outputter.rb
For Formatters:log4r/formatter/formatter.rb
For configuration:log4r/configurator.rb

Principal Classes of Log4r

Convenience Classes

Log4r provides several convenience Outputters and Formatters. Please look at the file overviews of those classes for more details.

Remote Logging

Log4r provides a way to send log events over a network. See log4r/logserver.rb for details.

What’s Going on Inside?

Log4r has an internal logger which records much of what goes on inside. To see the output, define a Logger named ‘log4r’ and give it an Outputter of some sort. It logs only at the lowest and highest priorities. That would be DEBUG and FATAL for the standard setup.

It is essential to view this data when using certain classes, like Log4r::LogServer and Log4r::EmailOutputter.

Other Info

Author:Leon Torres
Version:$Id: log4r.rb,v 1.10 2002/08/20 04:15:04 cepheus Exp $
Required files

log4r/outputter/fileoutputter log4r/outputter/consoleoutputters log4r/outputter/staticoutputter log4r/outputter/rollingfileoutputter log4r/formatter/patternformatter log4r/loggerfactory
Classes and Modules

Module Log4r
  ::Class Log4r::BasicFormatter
  ::Class Log4r::ConfigError
  ::Class Log4r::Configurator
  ::Class Log4r::DateFileOutputter
  ::Class Log4r::DefaultFormatter
  ::Class Log4r::EmailOutputter
  ::Class Log4r::FileOutputter
  ::Class Log4r::Formatter
  ::Class Log4r::IOOutputter
  ::Class Log4r::Log4rTools
  ::Class Log4r::LogEvent
  ::Class Log4r::LogServer
  ::Class Log4r::Logger
  ::Class Log4r::ObjectFormatter
  ::Class Log4r::Outputter
  ::Class Log4r::PatternFormatter
  ::Class Log4r::RemoteOutputter
  ::Class Log4r::RollingFileOutputter
  ::Class Log4r::RootLogger
  ::Class Log4r::SimpleFormatter
  ::Class Log4r::StderrOutputter
  ::Class Log4r::StdoutOutputter
  ::Class Log4r::SyslogOutputter
  ::Class Log4r::YamlConfigurator