mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-11-09 16:57:16 +08:00
新增:新增系统监控/登录日志功能,优化日志表结构,并新增记录错误信息(非未知异常不记录异常详情,只记录错误信息)
This commit is contained in:
@@ -57,4 +57,31 @@ public class LogContextHolder {
|
||||
public static void remove() {
|
||||
LOG_THREAD_LOCAL.remove();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在系统日志上下文中保存异常信息
|
||||
*
|
||||
* @param e
|
||||
* 异常信息
|
||||
*/
|
||||
public static void setException(Exception e) {
|
||||
LogContext logContext = get();
|
||||
if (logContext != null) {
|
||||
logContext.setErrorMsg(e.getMessage());
|
||||
logContext.setException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 在系统日志上下文中保存错误信息(非未知异常不记录异常信息,只记录错误信息)
|
||||
*
|
||||
* @param errorMsg
|
||||
* 错误信息
|
||||
*/
|
||||
public static void setErrorMsg(String errorMsg) {
|
||||
LogContext logContext = get();
|
||||
if (logContext != null) {
|
||||
logContext.setErrorMsg(errorMsg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user