org.springframework.security.oauth2.provider.error.LoggingWebResponseExceptionTranslator Maven / Gradle / Ivy
package org.springframework.security.oauth2.provider.error;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;
public class LoggingWebResponseExceptionTranslator extends DefaultWebResponseExceptionTranslator {
protected final Log logger = LogFactory.getLog(getClass());
@Override
public ResponseEntity translate(Exception e) throws Exception {
if (logger.isTraceEnabled()) {
logger.trace(e, e);
}
else if (logger.isWarnEnabled()) {
logger.warn(e);
}
return super.translate(e);
}
}