2

I am using logger to log the values of the variables for debuging. Because automatic debugging logs it is diffcult to find values

How to slient automatic logging?

Gainster
  • 5,309
  • 19
  • 59
  • 88
  • Have you considered using an actual debugger, such as the one described very thoroughly in the [Debugging Rails Applications](http://guides.rubyonrails.org/debugging_rails_applications.html) Rails Guide? Like most debuggers it lets you pause execution wherever you want or watch the value of any variable. – Jordan Running May 27 '12 at 05:30
  • I am facing chanllenges with watch http://stackoverflow.com/questions/10730578/aptana-3-and-ruby-debugging – Gainster May 27 '12 at 06:58

2 Answers2

2

You can't turn if off completely while still having your log messages go to the log, but there are a couple of solutions I can think of:

  1. Set logging to a very high level (like :fatal), then log your messages at that level. There shouldn't be much noise in the log at that log level.

  2. Prefix your log messages with a unique identifier, e.g. MYSTUFF, then grep for that when you're tailing the log: tail -f log/production.log | grep MYSTUFF. Doing it this way means you don't have to change your log configuration.

x1a4
  • 19,152
  • 5
  • 39
  • 39
1

You can configure Rails logger in config/application.rb. config.log_level defines the verbosity of the Rails logger. The available log levels are: :debug, :info, :warn, :error, :fatal.

Example:

config.log_level = :warn

Also read information about Logger: http://guides.rubyonrails.org/debugging_rails_applications.html#the-logger

thesis
  • 2,535
  • 5
  • 24
  • 37