Tomcat STDOUT as Error in Eclipse

前端 未结 5 1955
栀梦
栀梦 2021-02-07 00:11

I am configuring Tomcat (5.5) server in Eclipse (3.3.2). Once I add Tomcat and start it, the output is printed in Eclipse Console. This output is printed in RED indicating its S

5条回答
  •  情歌与酒
    2021-02-07 01:02

    It's in red because it's written to standard error (System.err), assuming you're using a normal configuration.

    Theoretically, the way to fix this is to adjust the logging configuration (which appears to be java.util.logging based) so that messages at INFO level and below are written to standard out instead. Unfortunately, this is a little bit messier than it might be because the ConsoleHandler class is hard-coded to write to standard error, and if you mix between writing to standard out and standard error, there's a good chance that you'll end up getting the logging messages written out of order. (That's bad. Very confusing.) You could fix it by subclassing StreamHandler and doing a lot of fiddling around – e.g., override publish so it sets the output stream if logging changes from high-level to low-level or vice versa – but I really doubt that the results are going to be what you desire. It's also going to be slow.

    Since in a production deployment of Tomcat you don't log to the console anyway (it logs to files by default) I suggest stopping worrying about this.

提交回复
热议问题