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 with STDERR
:
$ irb
>> $stderr.object_id == STDERR.object_id
=> true
Same object, for now. Send it elsewhere,
>> $stderr = File.open('/tmp/foo', 'w')
=> #
>> $stderr.puts "Uh-oh, foo"
=> nil
>> $stderr.flush # if you want to verify its output
=> #
>> $stderr.object_id == STDERR.object_id
=> false
$stderr
and STDERR
refer to different objects. STDERR
still streams to the terminal here,
>> STDERR.puts "Uh-oh, original STDERR"
Uh-oh, original STDERR
=> nil
Restore $stderr
,
>> $stderr = STDERR
=> #
>> $stderr.object_id == STDERR.object_id
=> true
And we're back!