gpt4 book ai didi

java - Eclipse 控制台不显示任何错误/日志输出

转载 作者:行者123 更新时间:2023-12-02 14:38:42 25 4
gpt4 key购买 nike

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

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

有人可以告诉我是什么原因导致我尝试了 Stackoverflow 中发布的不同 -2 问题中提到的很多事情吗?

更新:-

我尝试了下面的代码

public class test {

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

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

最佳答案

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

请转到Eclipse->服务器选项卡->单击“打开启动配置”->VM 参数

并将此参数添加到 VM 参数部分

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

在这里link有关该问题的更多详细信息

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.

关于java - Eclipse 控制台不显示任何错误/日志输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35717329/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com