我如何检查 java 控制台日志。?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41425909/
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-11-03 05:51:36  来源:igfitidea点击:

How do I check java console log.?

javajava-console

提问by Riddhi Makwana

I am running java application and because of some error it gets closed, I want to check the error in log. How can I reopen java console with that log or is there any other way to check the log of java console.?

我正在运行 java 应用程序,由于某些错误它被关闭,我想检查日志中的错误。如何使用该日志重新打开 java 控制台,或者有没有其他方法可以检查 java 控制台的日志。?

回答by Abhishek

Try printing something on the console.
Eg:System.out.println("Program Completed").

尝试在控制台上打印一些东西。
例如:System.out.println("Program Completed").

回答by P Punam

Put your code in try catch block, and print your exception in catch block.

将您的代码放在 try catch 块中,并在 catch 块中打印您的异常。