'Autoflush on System.out of my develope environment
In my develope environment I have tomcat (9.0) with the System.out.autoflush off. How can I set it to on?
EDIT:
I tried to put thoose lines:
private static boolean autoflushSetted = false;
void systemOutPrintln(String str) {
if (!autoflushSetted) {
autoflushSetted = true;
try {
Field af = PrintStream.class.getDeclaredField("autoFlush");
af.setAccessible(true);
af.set(System.out, Boolean.TRUE);
} catch (Throwable e) {
}
}
System.out.println(str);
}
I tried also to set autoFlush via reflection to the result of the method findStream on System.out, and verified that the println flushed the writing, but countines to not work. It seems that the console window in Eclipse doesn't see that there was an output until the thread is completed. I can't see any setting to force the console windows to be smarter. Eclipse has this behaviour only when I run tomcat projects, instead standalone projects where it runs well. I cannot understand.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|