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?
In a Rails app, logs are stored under the /log folder. In development mode, the development. log file is used & you see log output on the terminal you're running rails server on.
If you want to change all the default logging for that specific model, you can simply use User. logger = Logger. new(STDOUT) or wherever you want to log to. In the same way, ActiveRecord::Base.
INFO is used to log the information your program is working as expected. DEBUG is used to find the reason in case your program is not working as expected or an exception has occurred. it's in the interest of the developer.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With