A Powerful Logging Library for Ruby
 

What Log4r Is

Log4r is a comprehensive and flexible logging library written in Ruby for use in Ruby programs. It features a heiarchial logging system of any number of levels, custom level names, logger inheritance, multiple output destinations, execution tracing, custom formatting, thread safteyness and more.

Log4r intends to be easy to use and configure, no matter the complexity. Casual system scripts can use Log4r right away with minimal configuration and multi-platform distributed applications can set up a concise configuration in XML. Log4r comes with comprehensive documentation and plenty of examples. Furthermore, Log4r attempts to abide by the Principle of Least Surprise, such that it works as intended at all points.

While Log4r is interpreted, it attempts to achieve optimal performance and scale well. Already, plans are being made to write the performance-critical components as a C extension to Ruby.

Log4r was inspired by and provides much of the features of the Apache Log4j project, but is not a direct implementation or clone. Aside from superficial similarities, the projects are not related in any way and the code base is completely distinct. Log4r was developed without even looking at the Apache Log4j code.

Log4r is an Open Source project and intends to remain that way. The Log4r license is similar to the Ruby Language license. It resides on this page and in the distribution in a file named LICENSE.


But Why?

Why a logging system like Log4r? There are many non-obvious reasons. First, logging should not be confused with Unit testing. Unit testing and logging are complementary rather than exclusive. Second, logging provides a handy way for a program to provide useful information about itself to different audiences. With logging, your application's state can be tracked over time and not be a complete mystery. With Log4r, you can control the amount and type of information that show up without having to comment out the logging statements in your code. This helps reduce noise and maximize the usefulness of log files. Finally, logging is extremely useful in applications that are not all in one place (distributed). If you want to debug a client and server at the same time, a logging system like Log4r becomes critical.


Getting Started with Log4r

Follow these steps:
  1. Download the latest version from this page
  2. Try out the examples in the examples directory of the distribution
  3. Install by running ruby install.rb
  4. Read the nice manual
  5. Use Log4r
  6. Consult the Log4r RDoc API for reference
  7. Get REXML to take advantage of the XML config
  8. Contribute!
Bon voyage!


$Id: index.html,v 1.4 2002/01/16 12:24:28 cepheus Exp $