when an app is started, not from the console but from an开发者_如何学JAVA UI icon, where the standard stream goes, I mean can I for example see this log? Where the plain old System.out directs to as a "default" ?
As Angus said, without a console you don't get output.
Once you've launched your application as a GUI, you can set the System.out
field to log to another destination (rather than a TTY or a console), by using System.setOut. In that way you can write to a file by passing:
System.setOut(new PrintStream(path_to_a_file));
However, this is not advised.
The best thing you can do is to use a logging framework such as log4j or SLF4J, and perform logging (to a file, network host or console) that way.
If the app doesn't have a console then generally standard output doesn't go anywhere.
精彩评论