Packito
Packito

Reputation: 138

How to set Jersey JAX-RS server side logger level?

I want to know if there is a way to set the Jersey server side logger level. For example, my server keeps logging all the requests (INFO level), and I only want it to log SEVERE messages:

28-Mar-2016 11:42:19.551 INFO [http-nio-8080-exec-60] org.glassfish.jersey.filter.LoggingFilter.log 1 * Server has received a request on thread http-nio-8080-exec-60

I read the Jersey tracing documentation and I only find configurations about client side. The only thing that I read about server side is:

The collected tracing information related to a single request is returned to the requesting client in the HTTP headers of a response for the request. The information is also logged on the server side using a dedicated Java Logger instance.

But it does not mention how to configure this dedicated Java Logger instance.

Upvotes: 0

Views: 466

Answers (1)

arisalexis
arisalexis

Reputation: 2210

In your configuration class (Application.java?) put this:

Logger logger = Logger.getLogger(Application.class.getName());
logger.setLevel(Level.WARNING);
registerInstances(new LoggingFilter(logger, true));

Upvotes: 2

Related Questions