I'm using following code to configure logging in my Ruby on Rails application:
environment.rb:
Rails.logger = Logger.new(STDOUT)
class Logger
def format_message(severity, timestamp, progname, msg)
"#{timestamp.to_formatted_s(:db)} #{severity} #{msg}\n"
end
end
I'm trying to set the logging level to warn now using
config.log_level = :warn
in my production.rb, but it doens't seem to work. Am I missing something here?
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.
According to the official documentation, you should be using:
If neither of those work for you, try:
And if that doesn't work, try:
Note: The final method appears to be conflating the two official strategies, but works in some situations
For Rails 4.0 you can set the value in
production.rb
(or your desired environment) like so:Update The docs state it like so: