|
@@ -18,7 +18,6 @@ public class XxlJobFileAppender {
|
18
|
18
|
// for JobThread (support log for child thread of job handler)
|
19
|
19
|
//public static ThreadLocal<String> contextHolder = new ThreadLocal<String>();
|
20
|
20
|
public static final InheritableThreadLocal<String> contextHolder = new InheritableThreadLocal<String>();
|
21
|
|
- public static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // TODO, concurrent issues
|
22
|
21
|
public static String logPath = "/data/applogs/xxl-job/jobhandler/";
|
23
|
22
|
|
24
|
23
|
/**
|
|
@@ -37,6 +36,8 @@ public class XxlJobFileAppender {
|
37
|
36
|
}
|
38
|
37
|
|
39
|
38
|
// filePath/yyyy-MM-dd/
|
|
39
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); // avoid concurrent problem, can not be static
|
|
40
|
+
|
40
|
41
|
String nowFormat = sdf.format(new Date());
|
41
|
42
|
File filePathDateDir = new File(filePathDir, nowFormat);
|
42
|
43
|
if (!filePathDateDir.exists()) {
|
|
@@ -44,7 +45,7 @@ public class XxlJobFileAppender {
|
44
|
45
|
}
|
45
|
46
|
|
46
|
47
|
// filePath/yyyy-MM-dd/9999.log
|
47
|
|
- String logFileName = XxlJobFileAppender.sdf.format(triggerDate).concat("/").concat(String.valueOf(logId)).concat(".log");
|
|
48
|
+ String logFileName = sdf.format(triggerDate).concat("/").concat(String.valueOf(logId)).concat(".log");
|
48
|
49
|
return logFileName;
|
49
|
50
|
}
|
50
|
51
|
|