如何配置 log4j 来记录 Spring 注入
如何配置 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的想法是,真正的问题是让 Spring 或您的应用程序生成日志事件;例如,在相关点调用 Logger 上的相关方法。
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.