Rails Logger


#1

how to make default rails logger accessible in my custom modules,
because as I see now its available only for ActiveRecord and some
other Rails modules.


#2

not sure if that works, but in many cases
where logger.info doesn’t work (like in rspec specs)
you can use:
RAILS_DEFAULT_LOGGER.info “my text”


#3

I just dealt with the same problem:

from http://mikenaberezny.com/category/ruby/#rails-logger:
"From outside a controller or model, you can pass the logger instance
or access it with the constant RAILS_DEFAULT_LOGGER. "

also see:
http://www.boowebb.com/2008/01/09/writing-to-the-log-in-rails

Yoram


#4

thanks a lot guys