Created
July 19, 2012 07:35
-
-
Save linjian/3141367 to your computer and use it in GitHub Desktop.
Puts to Log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the following line to config/environments/development.rb or config/initializers/ | |
# So I can use puts or p to print debug message to log file when I use nginx, which has no way to see STDOUT directly. | |
if Rails.env.development? && $PROGRAM_NAME !~ /script\/rails/ && $PROGRAM_NAME !~ /rake/ | |
STDOUT.reopen(File.open("#{Rails.root}/log/development.log", 'a+')) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment