It is generally not recommended that you write the hard drive to System.out. As a quick fix, you can change all System.out references to your own static variable in one of your classes. This at least gives you the ability to change the stream you are writing. For instance.
public static void main(String[] args) { static public PringStream out = System.out; void someMethod() { out.println("some logging message"); } }
You can quickly replace all uses of System.out in your code with Myclass.out. After that, you can change the output stream according to the arguments or properties of the system. For instance.
if (Boolean.getBoolean("debug")) out = System.out; else out = new PrintStream(new OutputStream() { public void write(int data) throws IOException {} };
Of course, thatβs all for the pants and the distribution code.
A more reliable and flexible solution is to use the api log like slf4j .
mdma source share