确定Eclipse中的java应用程序是否处于调试模式 [英] Determine if a java application is in debug mode in Eclipse

查看:678
本文介绍了确定Eclipse中的java应用程序是否处于调试模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要更改日志记录级别,具体取决于我是否解除绑定,但是我找不到代码片段来检查应用程序是否以调试模式运行。


$ b $我正在使用eclipse来调试应用程序,所以如果解决方案只能在Eclipse中工作,那将很好。

解决方案

p>您可以修改调试配置。例如,仅在调试配置中添加一个特殊的VM参数。您可以使用System.getProperties()来读取提供的参数。



更好的是,修改配置(运行和调试)以加载其他日志记录配置文件。如果您需要编写代码来确定日志记录级别,那不是很好。这只是一个配置问题。


I want to change the logging level depending if I'm debbugging or not, but I can't find a code snippet to check if the application is running in debug mode.

I'm using eclipse to debug the application, so if the solution only works within Eclipse it will be fine.

解决方案

You could modify the Debug Configuration. For example add a special VM argument only in the Debug Configuration. You can use System.getProperties() to read the supplied arguments.

Even better, modify the configurations (Run and Debug) to load a different logging configuration file. It isn't good if you need to write code to determine the logging level. This should only be a matter of configuration.

这篇关于确定Eclipse中的java应用程序是否处于调试模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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