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 ?
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 ?
The
object_id
are initially the same but it's better to assign to$stderr
. That also leaves you open to return the stream to where it was originally withSTDERR
:Same object, for now. Send it elsewhere,
$stderr
andSTDERR
refer to different objects.STDERR
still streams to the terminal here,Restore
$stderr
,And we're back!
The line of
LOGGER = Logger.new("sinatra.log")
in @include's answer above did not work for me.However, an alternative listed here (along with some helpful explanations) worked for me, tested with ruby 2.5.3 and sinatra 2.0.1.
For additional info, that alternative is based on the structure presented in a Sinatra recipe.
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:
and/or
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.
have fun and post here your config.ru and/or the mainprojectfile.rb.