log4j 多个附加程序中的多个级别
我有两个附加程序:控制台和文件 我有三个包 uk.co.bar、uk.co.bar.foo、uk.co.pip
我需要将来自 uk.co.* 的所有消息(调试和更高版本)输入到文件中。
我希望将来自 uk.co.bar.foo 的信息消息提供给控制台 我希望来自 uk.co.bar.pip 的所有消息都发送到控制台
如果我使用记录器,它会限制两个附加程序的消息。 :-( 如果我在控制台附加程序中使用过滤器,我就会失去对我想要的包级别的控制。
有人有解决办法吗?
I have two appenders: console, and file
I have three packages uk.co.bar, uk.co.bar.foo, uk.co.pip
I need all messages (debug and higher) from uk.co.* to be fed into the file.
I want info messages from uk.co.bar.foo to fed to the console
I want all messages from uk.co.bar.pip to fed to the console
If I use a logger it restricts messages for both appenders. :-(
If I use filters in the console appender I loose control of the package-level i want.
Anyone have a solution?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看到这个答案。据我了解,这解决了您的问题
创建多个日志文件log4j 的不同内容
see this answer. As far as I understand this addresses your problem
Creating multiple log files of different content with log4j