日志消息从哪里来
找出日志消息来自何处的最简单方法是什么?我的日志文件包含一个警告,我想看看编写它的代码。然而,NetBeans 6.9 并不能让我轻松地做到这一点。有什么建议吗?
what is the easiest way to find out where a log message came from? My log file contains a warning, and I would like to have a look at the code that wrote it. However, NetBeans 6.9 does not make it easy for me to do that. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在代码中 grep 查找日志文件中的字符串。如果找不到它,则从其中搜索子字符串,因为它可能是由许多串联部分组成的。
You could grep within your code for the string in the log file. If you can't find it then search for a substring from within it as it may be build up from many concatenated parts.
一种实用的方法是复制日志消息或其一部分,然后右键单击项目节点,然后在上下文菜单中单击“搜索”。将复制的文本粘贴到搜索字段中,看看会发生什么。
A practical approach would be to copy the log message or a part of it, then right-click on your project node and then in the context menu click "Search". Paste your copied text in the search field and see what happens.