解析 Java 中记录器行的源代码

发布于 2025-01-12 04:43:21 字数 347 浏览 5 评论 0原文

我正在尝试读取应用程序的源代码,并通过解析它们,找到记录器行并确定格式化字符串和输入之间类型不匹配的记录器行。示例:

    appLogger.debug(()->“There are %d %s 
           errors occurred in method %s”, 
           anInteger, anInteger,aString);

作为示例,上面的第二个格式化程序和相应的错误具有类型不匹配。但是当这些发生在运行时时,例如使用方法等,在编译期间无法检测到。

我尝试了反射等,但由于我是编程新手,我找不到这样做的方法。感谢您的帮助。

提前致谢。

I am trying to read the source codes of an application, and by parsing them, find the logger lines and determine those with type mismatch between the formatted string and inputs. An example:

    appLogger.debug(()->“There are %d %s 
           errors occurred in method %s”, 
           anInteger, anInteger,aString);

As an example, above the second formatter and the corresponding error has type mismatch. But when these occur at runtime, such as using methods etc. it cannot be detected during compilation.

I tried reflection, etc. but since I am new to programming, I could not find a way of doing this. Appreciate your help.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文