How to debug log_level issue?

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

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.

Vish K wrote:

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.

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

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.

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

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

Vish K wrote:

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,

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

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 :wink: