Christopher Bottoms
Christopher Bottoms

Reputation: 11193

Can I configure Netbeans 7 to send all of the Console output to a file?

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.

Upvotes: 0

Views: 2529

Answers (1)

Robin
Robin

Reputation: 36621

The fact your code base uses log4j is rather irrelevant, since the System.out.println calls you want to redirect bypass the whole logging framework.

My first suggestion would be to replace the System.out.println calls by a log statement. A find-and-replace should almost allow you to do this.

Otherwise, you can just set another PrintStream as System.out using System.setOut. Example of this can be found here and here

Upvotes: 2

Related Questions