Browse Source

修改:WebMvcCOnfig修改日志格式转换器为yyyy-MM-dd HH:mnm:ss

dev_shibei_match
wxz 4 years ago
parent
commit
fa1ad97aed
  1. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java
  2. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java

@ -25,12 +25,22 @@ public class ExceptionUtils {
* @return 返回异常信息
*/
public static String getErrorStackTrace(Exception ex){
return getErrorStackTraceOfThrowable(ex);
}
/**
* @Description Throwable级别的错误信息
* @return
* @author wxz
* @date 2021.07.07 14:37
*/
public static String getErrorStackTraceOfThrowable(Throwable t) {
StringWriter sw = null;
PrintWriter pw = null;
try {
sw = new StringWriter();
pw = new PrintWriter(sw, true);
ex.printStackTrace(pw);
t.printStackTrace(pw);
}finally {
try {
if(pw != null) {

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/config/WebMvcConfig.java

@ -66,7 +66,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
//日期格式转换
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.setDateFormat(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN_END_WITH_MINUTE));
mapper.setDateFormat(new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN));
mapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
//Long类型转String类型

Loading…
Cancel
Save