Where is System.err located on Windows?

I have a Java GUI based application that records some diagnostic messages in System.out and System.err. Where are these messages displayed when working on Windows? (For example, on Mac OS X they are printed in the system console log.)

Edit

I have to add that the Java application is packaged as .exe, so (right now) I cannot start it using java. (I can copy individual .JAR files to a Windows test computer, I suppose.)

Also, this is an application that I inherited that had not previously used the framework; I would like to change it to use it, but I was hoping to quickly get some log output to diagnose the problem right now.

+3
source share
6 answers

It really depends on how you run your application. For example, if you want to start your GUI from the Windows command line (for example java -jar myApp.jar), then, as you might expect, both System.out and System.err will go to the console. If you run through the Windows shell (for example, by double-clicking the executable JAR), then these error streams will be lost, as far as I know. Setting up application execution as a service (as unlikely that this may sound in your situation) will also lose output.

, , script, . , GUI. , "" (, log4j java.util.logging) .

+2

, System.out System.err , setout() setErr().

, exmaple, ,

System.setOut(new PrintStream("output.txt"));
System.setErr(new PrintStream("err.txt"));

main(String[] args), .

+6

AFAIK, java java.exe, . javaw.exe, , // GUI. ( javaw.exe , ).

. log4j java.util.logging ...

+3

, javaw .jar, System.out System.err:

java.util.logging.config.file

"javaw" System.out System.err. "java" ( "w" ).

+2

System.err , . , .

+1

Java, java.

0

Source: https://habr.com/ru/post/1728862/


All Articles