问题
Rails.logger.info
does not write any information to log when used in initializer.
How to get logging in initializer?
回答1:
Rails.logger = Logger.new(STDOUT)
before
MyServer::Application.initialize!
in /config/environment.rb
回答2:
May be the log level is silencing your message. Is it production or development?
Take a look to your config.log_level
in your config/*.yml
files
来源:https://stackoverflow.com/questions/26377359/rails-logger-info-is-not-working-in-initializer