···1+require_relative 'app/init'
2+require_relative 'app/server'
3+4+# logging normally goes to either stdout or stderr depending on how it's run, if logging is enabled in Sinatra
5+# but Passenger routes it all to its main log file unless you use a config option that is premium only :\
6+# so we set up logging to a local file explicitly
7+8+Dir.mkdir('log') unless Dir.exist?('log')
9+$sinatra_log = File.new("log/sinatra.log", "a+")
10+11+# flush logs to the file immediately instead of buffering
12+$sinatra_log.sync = true
13+14+# Sinatra turns off its own logging to stdout if another logger is in the stack
15+use Rack::CommonLogger, $sinatra_log
16+17+run Server