title: Set logging levels in Ruby on Rails
body: <p>I'm using following code to configure logging in my Ruby on Rails application:</p>
  
  <p>environment.rb:</p>
  
  <pre><code>Rails.logger = Logger.new(STDOUT)
  
  class Logger
    def format_message(severity, timestamp, progname, msg)
      "#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
    end
  end
  </code></pre>
  
  <p>I'm trying to set the logging level to warn now using</p>
  
  <pre><code>config.log_level = :warn
  </code></pre>
  
  <p>in my production.rb, but it doens't seem to work. Am I missing something here?</p>
  
  <p>If I put Rails.logger.level = 4 in my environment.rb, it does seem to work. But I would like to configure things in my environment initializers.</p>