From 6b8ab82d1d7fb9d44d85eeb1dfd2e36d3c28c9cf Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期一, 10 六月 2019 11:30:21 +0800 Subject: [PATCH] 客服消息修改,新版大淘客数据添加 --- fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java b/fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java index 6ea645e..78492e1 100644 --- a/fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java +++ b/fanli/src/main/java/com/yeshi/fanli/log/LogHelper.java @@ -2,6 +2,7 @@ import java.io.File; import java.io.FileOutputStream; +import java.io.IOException; import java.io.OutputStream; import java.io.PrintStream; import java.util.ArrayList; @@ -92,7 +93,7 @@ loginLogger.info(obj); } - public static void errorDetailInfo(Throwable e) throws Exception { + public static void errorDetailInfo(Throwable e) { e.printStackTrace(); String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd"); String os = System.getProperty("os.name"); @@ -102,20 +103,28 @@ } else filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.txt", date); - OutputStream out = new FileOutputStream(new File(filePath), true); + OutputStream out = null; + try { + out = new FileOutputStream(new File(filePath), true); PrintStream ps = new PrintStream(out); ps.print(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); ps.print("\n"); e.printStackTrace(ps); ps.flush(); ps.close(); + } catch (Exception ee) { + } finally { - out.close(); + try { + out.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } } } - public static void errorDetailInfo(Throwable e, String params, String url) throws Exception { + public static void errorDetailInfo(Throwable e, String params, String url) { e.printStackTrace(); String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd"); String os = System.getProperty("os.name"); @@ -124,9 +133,9 @@ filePath = String.format("C:/logs/error_detail_%s.txt", date); } else filePath = String.format("/usr/local/tomcat8/logs/error_detail_%s.txt", date); - - OutputStream out = new FileOutputStream(new File(filePath), true); + OutputStream out = null; try { + out = new FileOutputStream(new File(filePath), true); PrintStream ps = new PrintStream(out); ps.print(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); ps.print("\n"); @@ -137,8 +146,14 @@ e.printStackTrace(ps); ps.flush(); ps.close(); + } catch (Exception e1) { + } finally { - out.close(); + try { + out.close(); + } catch (IOException e1) { + e1.printStackTrace(); + } } } -- Gitblit v1.8.0