Why doesn't JRuby script.rb > out.txt capture Java errors?
JRuby script.rb throws many Java errors.
I tried outputting to a text file, but only the output from the script itself is recorded. I need to capture all the 开发者_开发知识库errors that happen, as they are very long. How can I do that?
The errors probably go to the error stream (stderr), not the output stream (stdout). So you need to redirect the error stream into the output stream:
script.rb > out.txt 2>&1
Or, if you want just the errors:
script.rb 2> errors.txt
精彩评论