0 Replies Latest reply on Nov 22, 2013 8:14 AM by Susana Cabaco

    Resteasy: Exception logged as SEVERE in Jboss - How to log it differently?

    Susana Cabaco Newbie

      Every exception that happens within this rest api I have been working on ends up being logged in Jboss as SEVERE.

      This seems too harsh for what we need at the moment.


      I implemented a WebApplicationExceptionMapper and tried to make the exceptions being logged as ERROR instead and then return a Response object that holds the status and message that came already as a result of the failure.

      Something like this:


      public class WebApplicationExceptionMapper implements ExceptionMapper<WebApplicationException> {
          private static final Logger logger = LoggerFactory.getLogger(WebApplicationExceptionMapper.class);
          public Response toResponse(WebApplicationException exception) {
              logger.error("WebApplicationException thrown [statusCode: {}]", exception.getResponse().getStatus());
              return Response.status(exception.getResponse().getStatus())

      It seems to me like this is not really working, can anyone help?


      Thank you very much!