如何配置 log4j 来记录 Spring 注入

发布于 2024-09-08 02:26:21 字数 123 浏览 1 评论 0原文

如何配置 log4j 在每次注入类时向日志写入一个条目?

我的用例是这样的:我启用了自动装配。我有一些带有多个实现类的接口。我希望能够在日志中看到哪个 impl 类被注入到另一个类中。

有什么想法吗?

How can I configure log4j to write an entry to the log every time it injects a class?

My use case is this: I have Autowiring enabled. I have some interfaces with multiple implementing classes. I want to be able to see in the log which impl class gets injected to another class.

Any thoughts?

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

懒的傷心 2024-09-15 02:26:21

如何配置 log4j 在每次注入类时向日志中写入一个条目? ...有什么想法吗?

我的想法是,真正的问题是让 Spring 或您的应用程序生成日志事件;例如,在相关点调用 Logger 上的相关方法。

How can I configure log4j to write an entry to the log every time it injects a class? ... Any thoughts?

My thought is that the real problem is to get Spring or your application to generate the log events; e.g. to call the relevant methods on a Logger at the relevant point.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文