How do I change java logging console output from std err to std out?

后端 未结 13 1611
旧巷少年郎
旧巷少年郎 2020-11-27 06:50

I\'m using the standard ConsoleHandler from java.util.logging and by default the console output is directed to the error stream (i.e. System.

13条回答
  •  情话喂你
    2020-11-27 07:18

    If you use Java logging, you can change the default handler:

    For example, for files: Handler fh = new FileHandler(FILENAME); Logger.getLogger(LOGGER_NAME).addHandler(fh);

    If you want to output to a stream you can use StreamHandler, I think you can configure it with any output stream that you woud like, including the system stream.

提交回复
热议问题