Forum: Ruby on Rails How to debug log_level issue?

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.
Vish K (Guest)
on 2007-08-01 01:28
(Received via mailing list)
I'm running Rails 1.2.3 with mongrel and Ruby 1.8.6 on Windows.

I change the log_level in environment.rb from :debug to :warn
(or :error) but still see gobs of output in the development.log file.
The log_level setting seems to have no effect for me.  I also tried
putting in config.log_level = :warn in the environments/development.rb
file to no avail.

I did restart the server each time after making and saving the edits
to the file.

More than discovering a fix to my problem, I'd greatly appreciate any
pointers as to how to go about debugging this issue.

Thanks
Vish
Vish K (Guest)
on 2007-08-01 09:10
(Received via mailing list)
Okay it looks like RAILS_DEFAULT_LOGGER is set so the log_level
settings in the config files are ignored.  Can't seem to find who may
be setting the RAILS_DEFAULT_LOGGER.  Will appreciate any pointers.
Jacob A. (Guest)
on 2007-08-01 10:29
(Received via mailing list)
Vish K wrote:
>> putting in config.log_level = :warn in the environments/development.rb
>> file to no avail.
>>
>> I did restart the server each time after making and saving the edits
>> to the file.
>>
>> More than discovering a fix to my problem, I'd greatly appreciate any
>> pointers as to how to go about debugging this issue.
>>
>> Thanks
>> Vish

I believe there's a bug in script/server when used with Mongrel related
to this issue. Try searching the bugtracker at dev.rubyonrails.org for
more information.

--
Cheers,
- Jacob A.
Vish K (Guest)
on 2007-08-01 21:39
(Received via mailing list)
Jacob,

You're right about the bug.   I had to put this at the bottom of my
environment.rb to get what I wanted.

    RAILS_DEFAULT_LOGGER.level = Logger::WARN

Hope this helps someone else.

Thanks
Vish
Vish K (Guest)
on 2007-08-01 23:36
(Received via mailing list)
It seems that the offending line (that causes the logging settings in
the config files to be skipped) is

  Rails::Initializer.run(:initialize_logger)

in rails-1.2.3/lib/commands/servers/mongrel.rb.  This is line #50 for
me.  Due to this the RAILS_DEFAULT_LOGGER is set and you have to put a
setting like this in the config file:

  RAILS_DEFAULT_LOGGER.level = Logger::WARN
Jacob A. (Guest)
on 2007-08-01 23:45
(Received via mailing list)
Vish K wrote:
>
>>
>> Thanks
>> Vish

I seem to recall that you might be able to dodge the issue by using
"mongrel_rails start" instead of script/server. My memory has been known
to be corrupted though ;-)

--
Cheers,
- Jacob A.
This topic is locked and can not be replied to.