Log4r is a Ruby gem that features a heirachical logging system of any number of levels, custom level names, multiple output destinations per log event, custom formatting, and more. The Log4r gem is open sourced on GitHub, and with comphrehensive documentations available on Rubyforge.
I have been using log4r at work in most of the applications and systems written in Ruby. It’s easy to use, and provide the features that an application would need:
- Support multiple message levels such as Fatal, Error, Warn and Msg.
- Customizable log file format
- Multiple output destinations, like print out on the screen, and store in a log file
Here in this post, I’ll show you how to use log4r in your Ruby project.