My RoR efforts have culminated in JiggyMe, check it out!
You can do it like this using RAILS_DEFAULT_LOGGER.error, e.g.,
RAILS_DEFAULT_LOGGER.error("\n test \n")
This writes to one of 3 logs: development, test, production depending on what mode you are in when you executed the code. Enjoy!
Updated 10.30.2009
From one of the commenter
Since rails 2.1, there’s a more convenient way to log:
logger.debug ‘message’
You can use the following methods on logger: debug, info, warn, error, and fatal.





Thanks! This helped me out.
Comment by ngzax — June 22, 2007 @ 3:53 am |
Thanks !
Comment by erwan — July 8, 2007 @ 11:49 pm |
Thanks
thats saved some googling time
Comment by P — February 28, 2008 @ 4:07 am |
Simple post but just what I wanted and it works just like I hoped.
Many thanks
Doug M
Comment by Doug M — July 7, 2008 @ 8:06 pm |
Thanks!
Comment by Juan — February 13, 2009 @ 11:13 am |
Yes! This may be a tiny post, but as others have noted, it is exactly what we need at the moment. I’ve been programming for years but as a newbie to Ruby and Rails – much of the beauty of it was giving me the illusion that everything would be easy -of course that is never the case. Eventually one has to roll up one’s sleeves and revise some code.
Without a view into the black box I was starting to get a bit frustrated.
Thanks a ton for posting this!
Comment by Tony Adams — April 15, 2009 @ 7:13 am |
Thanks!!!
Comment by Nnanna — May 27, 2009 @ 7:11 am |
Since rails 2.1, there’s a more convenient way to log:
logger.debug ‘message’
You can use the following methods on logger: debug, info, warn, error, and fatal.
More info on http://maintainable.com/articles/rails_logging_tips
Comment by kikito — August 31, 2009 @ 5:08 am |
If you use Textmate there is a snippet you can call on by typing rdb and hitting tab.
This will type RAILS_DEFAULT_LOGGER.debug “message” for you.
Comment by Martin — October 30, 2009 @ 2:51 am |