# How to debug log\_level issue?

**URL:** <https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905>\
**Category:** Rails\
**Created:** [July 31, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905 "2007-07-31T23:28:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [July 31, 2007, 11:28pm UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/1 "2007-07-31T23:28:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [August 1, 2007, 7:10am UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/2 "2007-08-01T07:10:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [August 1, 2007, 8:29am UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/3 "2007-08-01T08:29:30Z")

</div>

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](http://dev.rubyonrails.org) for  
more information.

–  
Cheers,

- Jacob A.

---

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [August 1, 2007, 7:39pm UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/4 "2007-08-01T19:39:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [August 1, 2007, 9:36pm UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/5 "2007-08-01T21:36:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Vish\_K](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/91b2a8/32.png) [@Vish\_K](https://www.ruby-forum.com/u/Vish_K)\
**Post date:** [August 1, 2007, 9:45pm UTC](https://www.ruby-forum.com/t/how-to-debug-log-level-issue/110905/6 "2007-08-01T21:45:21Z")

</div>

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.
