In Java, how to block code from writing to system out?
My app calls a 3rd party library that spams logs by issuing numerous System.out.println() calls.
I don't have legal rights to decompile and patch the library.
I'm running Websphere 8.5.x
Considered using System.setOut(PrintStream out), but that will effect the entire process, while I only want to limit the effect to a single thread.
If you can identify the thread you want to "mute" reliably somehow (e.g. by name), you can
setOut
to your own stream which will only delegate the calls to the actualSystem.out
if they don't come from the muted thread.