We have a large java code base [~1 M Lines].
Buried (somewhere) in the code base is some old debug output to System.out that we want to remove (its cluttering things up).
The problem is: out code base is so large that we can’t easily find where the output is coming from. What we want is a way to see where System.out.println is getting called from (like a stack trace from an exception or some such).
Its not suitable to debugging — the errant output is coming from some errant thread somewhere etc.
Any ideas on how to track the source of this errant output down?
PS: 99.99% of calls to System.out are legit, and we have thousands of them, so simply searching the code base for System.out calls is not a solution!
There is a
System.setOut()method. If you are really desperate, set this to some wrapper of real stdout and do whatever in your wrapper. E.g. compare written string against something and throw if that’s the errant output.