Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Alternate logger for Rails that emits syslog-style output. For use with pl_analyze gem.
Ruby
branch: master
Failed to load latest commit information.
lib gemify
spec gemify
.rspec gemify
Gemfile gemify
Gemfile.lock gemify
MIT-LICENSE.txt License (MIT)
README.rdoc Update README.rdoc
Rakefile Add license to gemspec
hodel_3000_compliant_logger.gemspec Add license to gemspec

README.rdoc

Hodel 3000 Compliant Logger

The Hodel 3000 Compliant Logger outputs like SyslogLogger (seattlerb.rubyforge.org/SyslogLogger/), except it doesn't need a syslog daemon running, such that your log come out exactly like syslog logs.

Mostly, this is intended to let you use tools that assume your log are in this syslog format, including:

See initial announcement here: nubyonrails.com/articles/a-hodel-3000-compliant-logger-for-the-rest-of-us

Installation and configuration

gem install hodel_3000_compliant_logger

The main thing hodel_3000_complaint_logger provides is the Hodel3000CompliantLogger class. It's a subclass of Logger (ruby-doc.org/core/classes/Logger.html), so you can use it as you would any Logger, really, except it outputs slightly different.

require 'hodel_3000_compliant_logger'
log = Hodel3000CompliantLogger.new(STDOUT)
log.level = Logger::WARN

log.debug("Created logger")
log.info("Program started")
log.warn("Nothing to do!")

To use hodel_3000_complaint_logger in Rails 4 as a replacement for the default logger, place the following line in your config/application.rb:

config.logger = Hodel3000CompliantLogger.new(config.paths['log'].first)

In Rails 3, use the following line instead (in config/application.rb):

config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)

In Rails 2, instead use the following in your config/environment.rb file:

config.logger = Hodel3000CompliantLogger.new(config.paths.log.first)

NOTE

If you are using FastCGI, you may need to hard-code the hostname instead of using Socket.gethostname

Author

Geoffrey Grosenbach, with help from Eric Hodel

topfunky.com

Changes

  • Nov 29, 2007: Improvements and spec from Chris Bernard [logicleaf.com/]

Something went wrong with that request. Please try again.