Logging exceptions on Sinatra
Simply debugging an application in Sinatra it's a bit of a headache. Logging in particular was being kinda troublesome in our Passenger stack.
I've found out the following approach to solve the logging issue for us.
log_file = File.new("#{settings.root}/log/#{settings.environment}.log", 'a+')
STDOUT.reopen(log_file)
STDERR.reopen(log_file)
STDOUT.sync = true
STDERR.sync = true
Worth checking, the sinatra recipes website.
Written by Gus Bonfant
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#