RE: Re: log4r and rails


The first question I would ask (partially out of curiosity) is what
log4r specific feature are you trying to use?

While there are some neat log4r features, the built in logger provides
(from my perspective) a good logging framework already probably
addresses most logging needs.

That said, a basic setup to use log4r in rails follows a very similar
approach to using the built in logger.

Install the log4r gem

gem install log4r

Then edit your environment.rb file to use the gem and setup the logger

require “rubygems”
require “log4r”

#Setup Log4r Logging
L4R =“RailsLogging”)‘logfile’,

Once you have the logger defined you can then make logging calls from
within your model, controllers and views

Model / Controller

L4R.debug “Debug message from Model or controller”


<% L4R.debug “Test debug from a view” %>

Hope this helps get you started.