Hi
I dont know much about logging in rails? Could anybody please
explain how to do that in a live application? Or point me to any latest
links which gives a detailed description of how to do this for different
environments in rails? Why I am asking this is, I don't know where to
start. But have a vague idea about the levels info,debug, etc. But dont
know how to apply that (Or use it) in my application which is in an
initial stage.Please help
Have a look at the rails guide on debugging at
http://guides.rubyonrails.org/. This has information on using the
logger and other debugging techniques.
When starting with something new (Rails in this case) I suggest
starting with the built in tools, when you are familiar with those
then you can start looking round at other stuff that may or may not
provide further useful features.
Thanks for replying back. One more thing I need to clarify is when
to use the different levels for logging? For example say in controller
we can write
logger.info "some thing" or logger.warn "something"
How can we know that we should chose this here say info or warn
here? Is there any criteria for this? My question may be blunder please
excuse. Could you please pont to a good example?
If, in your application you are expecting value_a but it’s either nil or you have another value, that could be logger.error (if it’s critical to the continuation of the application) or if you can work around it but want to be notified about it to sort it out in the future it could be logger.warn,
I’m always use debug in development because that’s why I use it for, debug my app, better yet, change the default logger of Rails in your environment to point to STDERR and you’ll see your debug messages in the server shell