I’m working with a code base containing over 2500 System.out.println statements. Besides refactoring, is there a way to get them all to send their output to a file? I’m running it using Netbeans 7. Log4j is incorporated into the project, but only a few hundred Logger methods are used within the project.
I’m working with a code base containing over 2500 System.out.println statements. Besides refactoring, is
Share
The fact your code base uses log4j is rather irrelevant, since the
System.out.printlncalls you want to redirect bypass the whole logging framework.My first suggestion would be to replace the
System.out.printlncalls by a log statement. A find-and-replace should almost allow you to do this.Otherwise, you can just set another
PrintStreamasSystem.outusingSystem.setOut. Example of this can be found here and here