Default Logger -> Database log


#1

Hi listers,

I’m trying to save my log entries in the database using the following
technique :

http://wiki.rubyonrails.com/rails/pages/DatabaseLoggerWish

I’ve added the following code to the Environment.rb :


begin

RAILS_DEFAULT_LOGGER = DBErrorLogger.new()

rescue StandardError

RAILS_DEFAULT_LOGGER = Logger.new(STDERR)

RAILS_DEFAULT_LOGGER.level = Logger::WARN

RAILS_DEFAULT_LOGGER.warn(

  "Rails Error: Unable to access log database. Please ensure that 

your database settings are exact " +
“The log level has been raised to WARN and the output directed to
STDERR until the problem is fixed.”

)

end

[ActiveRecord, ActionController, ActionMailer].each { |mod|
mod::Base.logger ||= RAILS_DEFAULT_LOGGER }


But the log doesn’t get to the database and still is added to the log
files… what’s wrong !!!


Luc B.
SID - Université du Québec
removed_email_address@domain.invalid