tags:

views:

61

answers:

1

I am running a sinatra app through RACK.

To which file does the activity get logged ? Also how can I set the log file path ?

+2  A: 

Hi Prakashraman,

It depends. Many developers define their app log file to app/servername.log or just to the current path where the Rack app is loaded.

Yes you can change it's path.

Usually you get a config.ru file with something like:

  log = File.new("sinatra.log", "a+")
  $stdout.reopen(log)
  $stderr.reopen(log)

and/or

configure do
  LOGGER = Logger.new("sinatra.log")
  enable :logging, :dump_errors
  set :raise_errors, true
end

in this case the log file is located under appdir/sinatra.log. But remember this code can be anywhere in your Rack app, so please seek for "log" in your application directory.

$ cd projectname
$ grep -ri 'log' *

have fun and post here your config.ru and/or the mainprojectfile.rb
Francisco

PS: check this out http://codex.heroku.com/past/2010/3/1/logging/

include
Hi Francisco.Yep, this worked perfect for me.log_path = "<path-to-log-file>"LOGGER = Logger.new(log_path, "daily")log = File.new(log_path, "a+")STDOUT.reopen(log)STDERR.reopen(log)
Prakash Raman