diff --git a/dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java b/dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java index fdf9926a7..85ee00f1f 100644 --- a/dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java +++ b/dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java @@ -257,6 +257,7 @@ private static void writeLogToFile(String msg, Throwable t) { return; } FileOutputStream o = null; + File file = new File(filePath + File.separator + "dongtai_javaagent.log"); try { if (t != null) { StringWriter stringWriter = new StringWriter(); @@ -264,14 +265,13 @@ private static void writeLogToFile(String msg, Throwable t) { msg = msg + stringWriter; } - File file = new File(filePath + "/dongtai_javaagent.log"); o = new FileOutputStream(file, true); o.write(msg.getBytes()); o.write(System.getProperty("line.separator").getBytes()); o.flush(); o.close(); } catch (Exception e) { - DongTaiLog.error(e); + System.out.println("the log file " + file.getPath() + " is not writable: " + e.toString()); } } }