BigTablet.com Blog

June 17, 2009

Redirect Stdout and Stderr to Log in Passenger

Filed under: Ruby & Rails — ciddennis @ 2:40 pm

I recently moved my server to use passenger and found that while doing development I lost my standard out and error. After some work I found if I add this to the top of my environments.rb file all my standard out and error are put in file in the rails root / logs directory….


if ENV["TMPDIR"] && ENV["TMPDIR"].index("passenger")
std_out = File.new(RAILS_ROOT + "/log/stdout.log","a")
std_err = File.new(RAILS_ROOT + "/log/stderr.log","a")
$stdout.reopen(std_out)
$stderr.reopen(std_err)
end

About these ads

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: