Rails Development Log

Hi,
I am using Ruby+Rails with Mongrel.
Is there any way to disable logging so that everytime I start rails
(mongrel_rails start), it doesn’t automatically start logging info to
development.log
Thanks!

open config/environments/development.rb and you’ll see instantly how
you can turn off logging :wink:

Oh sorry about that. I thought it would be sticking out like a sore
thumb, but apparently it’s not very easy to turn off logging. You can
turn it down.

Here’s a hack I came up with that seems to work on my machine, but I
don’t know if I’d put this into production. Add this line to the
environment file you want to turn off logging for:

config.logger = Object.new.instance_eval { def method_missing(*m);
end; self }

It sets the logger to a dead, do nothing object. Setting logger to
nil and just a plain old Object.new don’t work – this one does
though…

Thanks, Eden.
I took a look at that file but couldn’t find an option that would turn
off logging (i know i’m probably dumb :slight_smile: and it must be something
straightforward!)

Anyway I’m copying the config/environments/development.rb file below…
maybe you could take a look and give some guidance? Thanks for your
help!!!

===========================================

Settings specified here will take precedence over those in

config/environment.rb

In the development environment your application’s code is reloaded on

every request. This slows down response time but is perfect for

development

since you don’t have to restart the webserver when you make code

changes.
config.cache_classes = false

Log error messages when you accidentally call methods on nil.

config.whiny_nils = true

Enable the breakpoint server that script/breakpointer connects to

config.breakpoint_server = true

Show full error reports and disable caching

config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching = false
config.action_view.cache_template_extensions = false
config.action_view.debug_rjs = true

Don’t care if the mailer can’t send

config.action_mailer.raise_delivery_errors = false

Alternatively stick
config.log_level = :info
into your development.rb file (see
http://glu.ttono.us/articles/2006/05/22/configuring-rails-environments-the-cheat-sheet
for info on what some of the other things there do).

This will filter out a lot of the stuff in the log (eg you won’t see all
SQL queries made any more) but you’ll still be able to see what requests
are being made and so on. You can crank it up even higher if you only
want to see errors, by setting config.log_level to :error

Fred

Thanks, Eden! I’ll try that. The reason I wanted to temorarily disable
logging was cuz the log files were getting huge in size.

Thanks, Fred. I’m going to try both the suggestions and hopefully it’ll
reduce the size of the log files!