|
@@ -199,24 +199,33 @@ public class CustomExceptionHandler {
|
|
|
boolean alwaysOK = alwaysOK(request);
|
|
|
ApiInfo apiInfo = (ApiInfo) request
|
|
|
.getAttribute(HttpServletRequestAttribute.$_API_INFO.name());
|
|
|
- boolean withoutStackTrace = false;
|
|
|
+
|
|
|
+ boolean printStackTrace = true;
|
|
|
if (null != apiInfo) {
|
|
|
- withoutStackTrace = apiInfo.isWithoutStackTrace();
|
|
|
+ printStackTrace = !apiInfo.isWithoutStackTrace();
|
|
|
+ }
|
|
|
+ if (!printStackTrace) {
|
|
|
+ String forcePrintStackTrace = System.getProperty("log.forcePrintStackTrace");
|
|
|
+ if (null != forcePrintStackTrace
|
|
|
+ && forcePrintStackTrace.equalsIgnoreCase(Boolean.toString(true))) {
|
|
|
+ printStackTrace = false;
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
if (alwaysOK) {
|
|
|
INTERFACE_LOG.error("[HTTP-RESP]. status=" + HttpStatus.OK.value());
|
|
|
- if (withoutStackTrace) {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
- } else {
|
|
|
+ if (printStackTrace) {
|
|
|
INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body), t);
|
|
|
+ } else {
|
|
|
+ INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
}
|
|
|
return new ResponseEntity<StatusResponse>(body, HttpStatus.OK);
|
|
|
} else {
|
|
|
INTERFACE_LOG.error("[HTTP-RESP]. status=" + HttpStatus.INTERNAL_SERVER_ERROR.value());
|
|
|
- if (withoutStackTrace) {
|
|
|
- INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
- } else {
|
|
|
+ if (printStackTrace) {
|
|
|
INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body), t);
|
|
|
+ } else {
|
|
|
+ INTERFACE_LOG.error("[HTTP-RESP]. response=" + JsonUtil.toJson(body));
|
|
|
}
|
|
|
return new ResponseEntity<StatusResponse>(body, HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
}
|