Reputation: 15058
I'm using Rails 5.2.5 and I want to change the log level when I use rails console. I want to stress that I don't want to change any file in the project, but just to do the change from the console.
I saw some suggestions to run:
conf.log_level = :debug
in the console, but I got the error
NameError (undefined local variable or method `config' for main:Object) Did you mean? conf
I also tried to execute
conf.log_level = :debug
but I also got the error:
Traceback (most recent call last): 2: from (irb):11 1: from (irb):11:in `rescue in irb_binding'
Do you have any suggestion?
Upvotes: 1
Views: 1757
Reputation: 914
Change YourApp
configuration (YourApp
located at config/environment/[environment].rb
YourApp.configure do
config.log_level = :info
end
Or you can use Rails.application.configure
2.5.8 :005 > Rails.application.configure do
2.5.8 :006 > puts(config.log_level)
2.5.8 :007?> end
debug
=> nil
2.5.8 :008 > Rails.application.configure do
2.5.8 :009 > config.log_level = :info
2.5.8 :010?> end
=> :info
2.5.8 :011 > Rails.application.configure do
2.5.8 :012 > puts(config.log_level)
2.5.8 :013?> end
info
Upvotes: 3