Many programs just use stdout and do not care, but I would prefer stderr in principle. In short, I believe that stdout is for the product of successful execution of the program, and stderr is for any messages intended for the user. The calculated values go to stdout , while errors, stack traces, help, version, and usage messages are for the user and should go to stderr .
I use this question to decide which output stream is appropriate: Is this message for the consumer of the main product of this program (whether it is a user user or another program or something else) or is it strictly for the person of this program?
In addition, it looks like Java uses stderr for version messages, as well: Why does java -version go into stderr?
Aaron a
source share