Eclipse 控制台未显示任何错误/日志输出

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35717329/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:04:29  来源:igfitidea点击:

Eclipse console not showing any error/log output

javaeclipsejboss

提问by Subodh Joshi

I am using Eclipse Kepler and i am running Java Web application in Jboss EAP 6.1. Today morning i noticed after deploying and running my web application no console output is coming.

我正在使用 Eclipse Kepler 并且我正在Jboss EAP 6.1 中运行 Java Web 应用程序。今天早上我注意到在部署和运行我的 Web 应用程序后没有控制台输出。

But console output showing when i am starting Jboss and its show everything which all application deployed etc. But after that nothing is printing in console .

但是控制台输出显示我何时启动 Jboss 及其显示所有应用程序部署的所有内容等。但之后控制台中没有打印任何内容。

Can someone please guild me what can be cause i tried plenty of thing mentioned in different -2 question posted in Stackoverflow.

有人可以指导我是什么原因导致我尝试了在 Stackoverflow 中发布的不同 -2 问题中提到的大量内容。

UPDATE :-

更新 :-

I tried below code

我试过下面的代码

public class test {

  public static void main(String arg[]){
    System.out.println("hariom");
  }
}

and its result printing in console but when i am deploying and running web application then only its not showing anything.

及其在控制台中打印的结果,但是当我部署和运行 Web 应用程序时,它没有显示任何内容。

回答by Subodh Joshi

Issue will fix with adding following VM argument in your server

问题将通过在服务器中添加以下 VM 参数来解决

Please Go Eclipse->Server Tab -> Click on Open Launch Configuration ->VM arguments

请离开 Eclipse->Server Tab -> Click on Open Launch Configuration ->VM arguments

And add this argument in VM argument section

并在 VM 参数部分添加此参数

-Dorg.jboss.as.logging.per-deployment=false

Here in this linkmore and detail about the issue

在此链接中提供有关该问题的更多详细信息

After reading what has been said in this thread, I'm trying to summarize the use of the per-deployment flag:

1.0 When per-deployment is true (default):

1.1 AS7.1.2 is scanning for logging configuration files in your deployment (WAR), If a configuration file is found then that deployment will get its own log context and be configured via the configuration file.

1.2 Once the properties file is found, it will be read and the application logging will go to wherever it has been specified to log (with the corresponding handler).

1.3 Logging jars don't need to be included with the application.

2.0 Setting the flag to false disables this feature, and the deployment scanner will not look for these files. Therefore:

2.1 You have to use the jboss-deployment-structure.xml to exclude the AS server's logging dependencies you are using and include them into your deployment.

2.2 Logging functionality is left up to the application. The application should have all the configuration files and required libraries (That's why the server's libraries have to be excluded)

2.3 If the application had, for example, a log4j.xml but no log4j dependency. The application will stop logging.

Personally, I'm using -Dorg.jboss.as.logging.per-deployment=false when I get missing dependencies errors at during deployment so that it displays in the console the stack trace for the missing class. Otherwise the only error we get in AS7's console (and server.log) is: Services with missing/unavailable dependencies Which does not make it easy to track down the missing dependency.

在阅读了该线程中的内容后,我正在尝试总结 per-deployment 标志的使用:

1.0 当 per-deployment 为 true(默认)时:

1.1 AS7.1.2 正在扫描您的部署 (WAR) 中的日志配置文件,如果找到配置文件,则该部署将获得自己的日志上下文并通过配置文件进行配置。

1.2 一旦找到属性文件,它将被读取并且应用程序日志记录将转到它被指定记录的任何地方(使用相应的处理程序)。

1.3 日志 jar 不需要包含在应用程序中。

2.0 将该标志设置为 false 将禁用此功能,并且部署扫描程序将不会查找这些文件。所以:

2.1 您必须使用 jboss-deployment-structure.xml 来排除您正在使用的 AS 服务器的日志依赖项,并将它们包含到您的部署中。

2.2 记录功能由应用程序决定。应用程序应具有所有配置文件和所需的库(这就是必须排除服务器库的原因)

2.3 例如,如果应用程序有一个 log4j.xml 但没有 log4j 依赖项。应用程序将停止记录。

就个人而言,当我在部署期间遇到缺少依赖项错误时,我使用 -Dorg.jboss.as.logging.per-deployment=false 以便它在控制台中显示缺少类的堆栈跟踪。否则,我们在 AS7 的控制台(和 server.log)中得到的唯一错误是: 具有缺失/不可用依赖项的服务 这并不容易追踪缺失的依赖项。