mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
0.14.2
This commit is contained in:
parent
803e636e25
commit
3fddc548b5
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>top.gotoeasy</groupId>
|
||||
<artifactId>glc-logback-appender</artifactId>
|
||||
<version>0.14.1</version>
|
||||
<version>0.14.2</version>
|
||||
<description>logback appender for glogcenter</description>
|
||||
|
||||
<repositories>
|
||||
|
||||
@ -11,27 +11,75 @@ public class MdcUtil {
|
||||
public static final String USER = "user";
|
||||
|
||||
public static void setUser(String user) {
|
||||
MDC.put(USER, user);
|
||||
try {
|
||||
MDC.put(USER, user);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static String getUser() {
|
||||
try {
|
||||
return MDC.get(USER);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void setClientIp(String clientip) {
|
||||
MDC.put(CLIENT_IP, clientip);
|
||||
try {
|
||||
MDC.put(CLIENT_IP, clientip);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static String getClientIp() {
|
||||
try {
|
||||
return MDC.get(CLIENT_IP);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void setTraceId(String traceid) {
|
||||
MDC.put(TRACE_ID, traceid);
|
||||
try {
|
||||
MDC.put(TRACE_ID, traceid);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static String getTraceId() {
|
||||
try {
|
||||
return MDC.get(TRACE_ID);
|
||||
} catch (Exception e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeUser() {
|
||||
MDC.remove(USER);
|
||||
try {
|
||||
MDC.remove(USER);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeClientIp() {
|
||||
MDC.remove(CLIENT_IP);
|
||||
try {
|
||||
MDC.remove(CLIENT_IP);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeTraceId() {
|
||||
MDC.remove(TRACE_ID);
|
||||
try {
|
||||
MDC.remove(TRACE_ID);
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user