Reputation: 2924
I am trying to debug a model in Rails so I'm using this code:
logger.debug('asasd')
However, I'm tailing the log file development.log but I'm not seeing it add to this file.
How do I get this to work?
Upvotes: 24
Views: 24525
Reputation: 107718
You could attempt to call flush
on the logger to force it to write to this file. Usually this would happen after every request:
logger.debug("asasd")
logger.flush
There's also the auto_flushing
setting on the Rails.logger
instance itself:
Rails.logger.auto_flushing = true
This will make the call to logger.flush
unnecessary, as Rails will automatically flush the buffered output to the log file whenever it is written to.
Upvotes: 4
Reputation: 6585
Make sure that you have set the log level to debug in environments/appropriate_env_file.rb:
config.log_level = :debug
and also make sure you are tailing the correct log file based on the environment you are running against.
Upvotes: 19