从外部使用Tomcat从IntelliJ运行Web应用程序时,发送到System.err的消息在哪里? [英] Where do messages sent to System.err go when using Tomcat externally to run a web app from IntelliJ?

查看:82
本文介绍了从外部使用Tomcat从IntelliJ运行Web应用程序时,发送到System.err的消息在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 IntelliJ 2019.3最终版 Vaadin Web应用程序通过 Apache Tomcat

I am using IntelliJ 2019.3 Ultimate edition IDE to run my Vaadin web app through Apache Tomcat web container.

当消息发送到 System.err 如:

When a message goes out to System.err such as:

System.err.println( "My message goes here." ) ;

…该消息到达何处?

在IntelliJ内显示的控制台上,我看到一条消息,该消息已发送到

On the console displayed within IntelliJ I see message appear that I sent to System.out. But message sent to System.err fail to appear on that same console.

推荐答案

再次检查该控制台

消息确实应该出现在IntelliJ的同一控制台中.

Check that console again

The messages should indeed appear in the same console within IntelliJ.

您可能没有注意到的原因有两个:颜色和顺序.

You may not have noticed for a couple of reasons: color, and order.

当心着色.假设System.err中的err表示错误",则IntelliJ将诸如红色墨水之类的消息着色.

Beware of coloring. Given that the err in System.err means "error", IntelliJ colorizes such messages as red ink.

Vaadin生成许多不同颜色的文本.您的眼睛可能会跳过那些有色块,寻找其他颜色(例如在黑暗模式下黑色背景上的白色墨水).

Vaadin generates much text in various colors. Your eye may be skipping over those colored blocks, looking for other colors (such as white ink on black background in in dark mode).

单击以放大下面由该代码创建的屏幕截图:

Click to zoom the screenshot below created by this code:

System.out.println( "BASIL sout - " + message );
System.err.println( "BASIL System.err message" );

第3行和第5.

  • 红色的第3行是从呼叫到System.err.
  • 白色的第5行是从呼叫到System.out.
  • Line 3 in red is from call to System.err.
  • Line 5 in white is from call to System.out.

(第4行来自对 Simple SLF4 日志记录框架的实现,与此处无关.)

(Line 4 is from a call made to the Simple implementation of SLF4 logging framework, and is irrelevant here.)

由于其他原因,您可能没有注意到消息:它们以不同于您在Java代码中调用的顺序到达控制台.

You may not have noticed your messages for another reason: They may arrive in the console in a different order than you called in your Java code.

在上面的屏幕截图中再次看到.那些第3行和第5乱序到达:我们在Java中的第二次调用首先出现在控制台输出中(我不知道为什么).

See again in that screenshot above. Those lines 3 & 5 arrived out-of-order: Our second call in Java appeared first in the console output (I don’t know why).

这篇关于从外部使用Tomcat从IntelliJ运行Web应用程序时,发送到System.err的消息在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆