Forum: Ruby on Rails Rails Development 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.
jen (Guest)
on 2007-03-24 06:31
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!
Eden L. (Guest)
on 2007-03-25 07:35
(Received via mailing list)
open config/environments/development.rb and you'll see instantly how
you can turn off logging ;-)
jen (Guest)
on 2007-03-25 08:58
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 :) 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
==========================================================
Eden L. (Guest)
on 2007-03-25 23:53
(Received via mailing list)
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...
jen (Guest)
on 2007-03-26 09:06
Thanks, Eden! I'll try that.  The reason I wanted to temorarily disable
logging was cuz the log files were getting huge in size.
Fred (Guest)
on 2007-03-26 12:08
Alternatively stick
config.log_level = :info
into your development.rb file (see
http://glu.ttono.us/articles/2006/05/22/configurin...
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
jen (Guest)
on 2007-03-27 08:32
Thanks, Fred.  I'm going to try both the suggestions and hopefully it'll
reduce the size of the log files!
This topic is locked and can not be replied to.