目前我正在运行泽西2.14(和灰熊2.16),虽然我没有看到关于日志的更新/旧版本有太大的区别。如何在泽西岛2.x禁用日志记录
我试图禁用类似下面的消息:
INFO: 2 * Server responded with a response on thread Grizzly-worker(15)
2 < 201
2 < Location: somewhere
从每当我做,嗯,什么事在生产环境中。我甚至有,我认为会隐藏客户端和服务器的方法的准系统类:
@Provider
public class MyLoggingFilter extends LoggingFilter
{
@Override
public void filter(ClientRequestContext context) throws IOException
{
// Do nothing.
//super.filter(context);
}
}
和
@Provider
public class MyLoggingFilter extends LoggingFilter
{
@Override
public void filter(ContainerRequestContext context) throws IOException
{
// Do nothing.
//super.filter(context);
}
}
应当指出的是,这些方法越来越打,因为我通过跟踪发现声明。
是否有一些ServerProperty或其他切换选项,我没有看到这是负责这个,所以我可以在生产过程中关闭此功能?
谢谢!
LoggingFilter默认情况下未注册,因此您必须在某处明确注册它。你能向我们展示你的应用程序子类(你注册资源和提供者的地方)吗?此外,您的自定义日志过滤器还应该覆盖响应的过滤方法 - 您看到的日志是已记录的响应,而不是请求。 – 2015-02-24 22:05:55