Reputation: 61
Currently I'm running Jersey 2.14 (and Grizzly 2.16), though I don't see much difference in newer/older versions regarding logging.
I'm trying to disable message like the following:
INFO: 2 * Server responded with a response on thread Grizzly-worker(15)
2 < 201
2 < Location: somewhere
From whenever I do, well, anything in a production environment. I even have a barebones class that I thought would hide the method for client and server:
@Provider
public class MyLoggingFilter extends LoggingFilter
{
@Override
public void filter(ClientRequestContext context) throws IOException
{
// Do nothing.
//super.filter(context);
}
}
and
@Provider
public class MyLoggingFilter extends LoggingFilter
{
@Override
public void filter(ContainerRequestContext context) throws IOException
{
// Do nothing.
//super.filter(context);
}
}
It should be noted that these methods are getting hit, as I found out via trace statements.
Is there some ServerProperty, or other toggleable option, I'm not seeing that is responsible for this so I can turn this off during production?
Thanks!
Upvotes: 0
Views: 3275
Reputation: 61
I found the solution: Because of the
@Provider
decoration, the LoggingFilter was being registered automatically. By removing it, I was able to control the logging and thus disable the logging messages.
Upvotes: 1
Reputation: 1265
Check your web.xml and/or Application class. Jersey logging filter if added in web.xml will be:
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>org.glassfish.jersey.filter.LoggingFilter</param-value>
</init-param>
If configured as a Application class it will be included in the class extending org.glassfish.jersey.server.ResourceConfig.
Upvotes: 0