log4j 多个附加程序中的多个级别

发布于 2024-09-30 06:35:13 字数 271 浏览 0 评论 0原文

我有两个附加程序:控制台和文件 我有三个包 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 技术交流群。

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

发布评论

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

评论(1

挖个坑埋了你 2024-10-07 06:35:13

看到这个答案。据我了解,这解决了您的问题

创建多个日志文件log4j 的不同内容

see this answer. As far as I understand this addresses your problem

Creating multiple log files of different content with log4j

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