Reputation: 25748
For Rails4 application, is there a way to use logger in the application.rb?
I need to print out some log information here before anything else.
Upvotes: 1
Views: 536
Reputation: 1351
Yes, it is possible:
logger = ActiveSupport::TaggedLogging.new(Logger.new(File.join(Rails.root, "log/configuration.log")))
logger.info("Some log entry")
If you want to redirect all log output to the console you may try:
logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
logger.info("Some log entry to the console")
or for simply inspection of something:
puts "Another log entry to the console"
Upvotes: 1