Fri 16 Jan 2009
I always forget this - being a java programmer originally I tend to think of things in java parlance when I’m looking for a way to do them in ruby. Right now I want to print the stack trace to the log in the enhancements to the merb uploader I’m doing, and, anyway - heres how you do it in ruby.
begin
some code
rescue Exception=>e
Merb.logger.error(e.backtrace.join("\n"))
end
Also - to get merb to log to a file make sure your settings are correct in init.rb or whichever env you are in.
i.e. c[:log_file] = Merb.root / “log” / “development.log”