title: Rails 3.2.x: How to change logging levels without restarting the application
body: <p>I would like to change the logging levels of a running Rails 3.2.x application without restarting the application. My intent is to use it to do short-time debugging and information gathering before reverting it to the usual logging level. </p>
  
  <p>I also understand that the levels in ascending order are debug, info, warn, error, and fatal, and that production servers log info and higher, while development logs debug and higher. </p>
  
  <p>I understand that if I run </p>
  
  <pre><code>Rails.logger.level=:debug #or :info, :warn, :error, :fatal
  </code></pre>
  
  <p>Will this change the logging level immediately?</p>
  
  <p>If so, can I do this by writing a Rake task to adjust the logging level, or do I need to support this by adding a route? For example in config/routes.rb: </p>
  
  <pre><code>match "/set_logging_level/:level/:secret" =&gt; "logcontroller#setlevel" 
  </code></pre>
  
  <p>and then setting the levels in the logcontroller. (:level is the logging level, and :secret which is shared between client and server, is something to prevent random users from tweaking the log levels) </p>
  
  <p>Which is more appropriate, rake task or /set_logging_level? </p>