b735bcc1d14b94036104ee25775d53fbb3b15ee9.svn-base
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.activiti.tracelog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ActivitiLog {
private static Logger logger = LoggerFactory.getLogger(ActivitiLog.class);
public static final ThreadLocal<Boolean> batchProcessThread = new ThreadLocal<Boolean>();
public static void debug(String info) {
if (logger.isDebugEnabled() && (batchProcessThread.get()==null || !batchProcessThread.get())) {
logger.debug(CurrentLineInfo.getClassName()+"."+CurrentLineInfo.getMethodName()+"[line:"+CurrentLineInfo.getLineNumber()+"]:"+info);
}
}
public static boolean isTraceDebug(){
return logger.isDebugEnabled();
}
static class CurrentLineInfo {
private static final int originStackIndex = 3;
public static String getFileName() {
return Thread.currentThread().getStackTrace()[originStackIndex].getFileName();
}
public static String getClassName() {
return Thread.currentThread().getStackTrace()[originStackIndex].getClassName();
}
public static String getMethodName() {
return Thread.currentThread().getStackTrace()[originStackIndex].getMethodName();
}
public static int getLineNumber() {
return Thread.currentThread().getStackTrace()[originStackIndex].getLineNumber();
}
}
}