Forum: Ruby on Rails Default Logger -> Database log

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
luc_boudreau (Guest)
on 2005-12-09 21:14
(Received via mailing list)
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
This topic is locked and can not be replied to.