阻止WLP将System.out写入messages.log

问题描述 投票:1回答:1

我有一个WebSphere应用程序,它使用一些第三方库将HTTP流量写入System.out / PrintWriter。 WLP默认将这些消息写入messages.log文件。我想禁用它,因为HTTP流量中可能有合理的数据,我不想记录。

In the documentation我只看到console.log LogLevel的设置,但没有看到messages.log的设置。有没有办法为这个文件设置LogLevel或只是禁用它?

logging websphere websphere-liberty websphere-8
1个回答
1
投票

没有办法将Liberty配置为不在messages.log文件中存储System.out消息。

我从上面的评论中看到,您已找到针对此特定案例的解决方案。对于读这篇文章的其他人来说,如果你真的被卡住了,你可以编写自己的PrintStream并使用System.setOut(printStream)来过滤实际进入stdout的内容。在委派给Liberty printStream之前,您的PrintStream可以在所有打印方法的开头实现过滤器。

PrintStream libertyPrintStream = System.out;
PrintStream myPrintStream = new MyPrintStream(libertyPrintStream);
System.setOut(myPrintStream);
© www.soinside.com 2019 - 2024. All rights reserved.