Java – system. Java on Windows Where’s err?

I have a Java GUI based application that writes some diagnostic messages to system Out and system err. Where are these messages output when running on windows? (for example, on Mac OS X, they print to the system console log.)

edit

I should add that Java applications are packaged as Exe, so (now) I can't start it using Java (I think I can copy various. Jar files to the windows test machine.)

In addition, it is an application I inherited and has not used the logging framework before; I want to modify it to use one, but I want to quickly get some log output to diagnose the problem immediately

Solution

It really depends on how you start the application For example, if you want to launch the GUI from a Windows command line prompt (for example, Java - jar myapp. Jar), you might find system Out and system Err will enter the console If you start from the Windows shell itself (for example, double clicking an executable jar), these error streams will be lost, as far as I know Setting the execution of the application as a service (which may sound unlikely in your case) will also lose the output stream

It is not always a good idea to use standards in put and output streams unless you expect to call your programs in shell script type environments, which are common channels for communication. As you can see for yourself, these are often poorly defined in Gui environments If you really want to capture text information while the program is running, consider using a "real" logging framework (such as log4j or the java.util.logging package) to capture messages into the log

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>