日志修改
This commit is contained in:
parent
ea985ee01f
commit
d8ce26b057
@ -70,7 +70,7 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
||||
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
|
||||
for (StackTraceElement e : stackTrace) {
|
||||
if (e.getClassName().startsWith("com.zhgd") && notInPackage(e.getClassName()) && !e.getClassName().contains("$$")) {
|
||||
sb.append(e.getClassName());
|
||||
sb.append(StrUtil.subAfter(e.getClassName(),".",true));
|
||||
sb.append(".");
|
||||
sb.append(e.getMethodName());
|
||||
sb.append("(");
|
||||
@ -78,7 +78,7 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
||||
sb.append(".java:");
|
||||
sb.append(e.getLineNumber());
|
||||
sb.append(")");
|
||||
sb.append("\r\n");
|
||||
sb.append(" > ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
@ -117,13 +117,13 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
||||
if (EnvironmentUtil.getActiveEnvironment().equals("gsx-other-env-show-dev")) {
|
||||
//开发环境
|
||||
if (sct == SqlCommandType.SELECT) {
|
||||
log.debug("查询mapper方法:\r\n {} >>> {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
log.debug("查询mapper: {} {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
} else if (sct == SqlCommandType.UPDATE) {
|
||||
log.debug("更新mapper方法:\r\n {} >>> {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
log.debug("更新mapper: {} {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
} else if (sct == SqlCommandType.INSERT) {
|
||||
log.debug("插入mapper方法:\r\n {} >>> {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
log.debug("插入mapper: {} {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
} else if (sct == SqlCommandType.DELETE) {
|
||||
log.debug("删除mapper方法:\r\n {} >>> {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
log.debug("删除mapper: {} {}#{}", getCallPositionForDev(), clazz.getName(), methodName);
|
||||
}
|
||||
} else {
|
||||
if (sct == SqlCommandType.SELECT) {
|
||||
|
||||
@ -7,7 +7,7 @@ public class RequestIdUtil {
|
||||
public static final String REQUEST_ID = "requestId";
|
||||
|
||||
public static void setRequestId() {
|
||||
MDC.put(REQUEST_ID, IdUtil.fastSimpleUUID());
|
||||
MDC.put(REQUEST_ID, getRandomStr());
|
||||
}
|
||||
|
||||
public static String getRequestId() {
|
||||
@ -15,7 +15,11 @@ public class RequestIdUtil {
|
||||
}
|
||||
|
||||
public static void setRequestId(String s) {
|
||||
MDC.put(REQUEST_ID, IdUtil.fastSimpleUUID() + s);
|
||||
MDC.put(REQUEST_ID, getRandomStr() + s);
|
||||
}
|
||||
|
||||
private static String getRandomStr() {
|
||||
return IdUtil.fastSimpleUUID().substring(0, 5);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false" scan="false">
|
||||
<configuration debug="false" scan="true">
|
||||
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue="logs"/>
|
||||
<property name="log.path" value="logs/${spring.application.name}"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{requestId}] [%thread] %highlight(%-5level) %method:%L %cyan(%logger{50}) - %highlight(%msg) %n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%X{requestId}][%thread] %highlight(%-5level) %method:%L %cyan(%logger{50}) - %highlight(%msg) %n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
<file>${log.path}/zhgd-debug.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{requestId}] [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%X{requestId}] [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
@ -43,7 +43,7 @@
|
||||
<file>${log.path}/zhgd-info.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{requestId}] [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%X{requestId}] [%thread] %-5level %logger{56}.%method:%L - %msg%n</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
@ -69,7 +69,7 @@
|
||||
<file>${log.path}/zhgd-error.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{requestId}] [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%X{requestId}] [%thread] %-5level %logger{50} - %msg%n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
@ -95,7 +95,7 @@
|
||||
<file>${log.path}/zhgd-all.log</file>
|
||||
<!--日志文件输出格式-->
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%X{requestId}] [%thread] %highlight(%-5level) %method:%L %cyan(%logger{50}) - %highlight(%msg) %n</pattern>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%X{requestId}] [%thread] %highlight(%-5level) %method:%L %cyan(%logger{50}) - %highlight(%msg) %n</pattern>
|
||||
<charset>UTF-8</charset> <!-- 设置字符集 -->
|
||||
</encoder>
|
||||
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user