Reputation: 10400
I created a new logger
my_logger = Logger.new(File.join(Rails.root, 'log', 'my_log.log'))
my_logger.info "my message"
and I tried logging some bit of texts on this log file.
Here is the logger_level of all my environments.
Development = 0 - Logger::DEBUG
Staging = 1 - Logger::INFO
Production = 1 - Logger::INFO
This works perfectly in development and staging environments. But the my_logger.info "my message"
does nothing in production environment. It doesn't throw any error also. Can you tell what could have gone wrong in just "production" environment with my new logger?
Upvotes: 2
Views: 3803
Reputation: 1381
Try putting this in application.rb
if defined?(Rails) && (Rails.env == 'development')
Rails.logger = Logger.new(STDOUT)
end
Upvotes: 0
Reputation: 689
If you're looking to customize the output of the Rails3 logger, try this gem: https://github.com/johmas/itslog
Upvotes: 2