Reputation: 368
My Ruby (JRuby) app loads a couple of Java libraries (not maintained by my team) and in those Java librares there are a few System.out.println that are outputting on my app.
In the Ruby side I have redirected STDOUT and STDERR to a log file and I would like to also have the ones coming from Java layer to also output to my file.
Any ideas how I can achieve this?
Thank you!
Upvotes: 0
Views: 629
Reputation: 19225
You can redirect System.out and System.err by using the System.setOUt() and System.setErr() methods. They both take a PrintStream.
Take a look at : https://blogs.oracle.com/nickstephen/entry/java_redirecting_system_out_and
Upvotes: 1