Logging in Rails

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

Thanks in advance
Tom

Also take a look at Ruby’s Logger documentation
http://www.ruby-doc.org/stdlib/libdoc/logger/rdoc/

anl

Hi
Thanks for all reply. When googling I saw this

http://toolmantim.com/thoughts/logging_rails_to_syslog_with_sysloglogger

Since a beginner I am asking what will be the advantage if using 

above? And also I would like to know what are the latest happenings like
this

Thanks
Tom

On 16 March 2010 09:03, Tom M. [email protected] wrote:

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.

Colin

On 16 March 2010 10:44, Tom M. [email protected] wrote:

Hi
Thanks for all reply. When googling I saw this

http://toolmantim.com/thoughts/logging_rails_to_syslog_with_sysloglogger

Since a beginner I am asking what will be the advantage if using
above? And also I would like to know what are the latest happenings like
this

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.

Colin

Hi Colin

 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?

Tom

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,

logger.info could be “I’m here #{value_a}”

Anyway, it’s up to you to decide what is a warning and what is an error.

I just googled this for you …

http://www.faqs.org/docs/evms/loglevels.html

On 16 March 2010 12:03, Tom M. [email protected] wrote:

Tom
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


100% naturally selected. 0% designed.

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

via guides.rubyonrails.org
ActiveRecord::Base.logger = Logger.new(STDERR)


anl

On Tue, Mar 16, 2010 at 12:19 PM, Anthony G.
<[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs