refactor: 日志按照模块生成文件

This commit is contained in:
fit2-zhao 2023-04-26 10:56:54 +08:00
parent 6fcf254a05
commit 44a3bb69ef
12 changed files with 127 additions and 778 deletions

View File

@ -149,7 +149,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="apiAppender"/>
</appender>
<logger name="api-test" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.api" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="apiTestAppender"/>
</logger>
@ -177,7 +177,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="loadAppender"/>
</appender>
<logger name="load-test" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.load" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="loadTestAppender"/>
</logger>
@ -206,7 +206,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="projectAppender"/>
</appender>
<logger name="project-management" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.project" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="projectManagementAppender"/>
</logger>
@ -236,7 +236,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="systemAppender"/>
</appender>
<logger name="system-setting" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.system" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="systemSettingAppender"/>
</logger>
@ -265,7 +265,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="testPlanAppender"/>
</appender>
<logger name="test-plan" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.plan" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="testPlanRefAppender"/>
</logger>
@ -293,7 +293,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="testTrackAppender"/>
</appender>
<logger name="test-track" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.track" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="testTrackRefAppender"/>
</logger>
@ -322,7 +322,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="uiTestAppender"/>
</appender>
<logger name="ui-test" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.ui" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="uiTestRefAppender"/>
</logger>
@ -351,7 +351,7 @@
<queueSize>10000</queueSize>
<appender-ref ref="workstationAppender"/>
</appender>
<logger name="workstation" additivity="false" level="${logger.level:INFO}">
<logger name="io.metersphere.workstation" additivity="false" level="${logger.level:INFO}">
<appender-ref ref="workstationRefAppender"/>
</logger>

View File

@ -2,129 +2,174 @@ package io.metersphere.sdk.util;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
public class LogUtils {
//日志工具类
public static final String DEBUG = "DEBUG";
public static final String INFO = "INFO";
public static final String WARN = "WARN";
public static final String ERROR = "ERROR";
public static void writeLog(Object msg, String level, Logger logger) {
if (logger != null && logger.isInfoEnabled()) {
switch (level) {
case DEBUG -> logger.debug(LogUtils.getMsg(msg));
case INFO -> logger.info(LogUtils.getMsg(msg));
case WARN -> logger.warn(LogUtils.getMsg(msg));
case ERROR -> logger.error(LogUtils.getMsg(msg));
default -> logger.error(StringUtils.EMPTY);
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger(LogUtils.getLogClass());
}
public static void writeLog(Object msg, String level) {
Logger logger = LogUtils.getLogger();
if (DEBUG.equals(level)) {
if (logger != null && logger.isDebugEnabled()) {
logger.debug(LogUtils.getMsg(msg));
}
} else if (INFO.equals(level)) {
if (logger != null && logger.isInfoEnabled()) {
logger.info(LogUtils.getMsg(msg));
}
} else if (WARN.equals(level)) {
if (logger != null && logger.isWarnEnabled()) {
logger.warn(LogUtils.getMsg(msg));
}
} else if (ERROR.equals(level)) {
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg));
}
} else {
if (logger != null && logger.isErrorEnabled()) {
logger.error(StringUtils.EMPTY);
}
}
}
public static void info(Object msg, Logger logger) {
public static void info(Object msg) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isInfoEnabled()) {
logger.info(LogUtils.getMsg(msg));
}
}
public static void info(Object msg, Object o1, Logger logger) {
public static void info(Object msg, Object o1) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isInfoEnabled()) {
logger.info(LogUtils.getMsg(msg), o1);
}
}
public static void info(Object msg, Object o1, Object o2, Logger logger) {
public static void info(Object msg, Object o1, Object o2) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isInfoEnabled()) {
logger.info(LogUtils.getMsg(msg), o1, o2);
}
}
public static void info(Object msg, Object[] obj, Logger logger) {
public static void info(Object msg, Object[] obj) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isInfoEnabled()) {
logger.info(LogUtils.getMsg(msg), obj);
}
}
public static void debug(Object msg, Logger logger) {
public static void debug(Object msg) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isDebugEnabled()) {
logger.debug(LogUtils.getMsg(msg));
}
}
public static void debug(Object msg, Object o, Logger logger) {
public static void debug(Object msg, Object o) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isDebugEnabled()) {
logger.debug(LogUtils.getMsg(msg), o);
}
}
public static void debug(Object msg, Object o1, Object o2, Logger logger) {
public static void debug(Object msg, Object o1, Object o2) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isDebugEnabled()) {
logger.debug(LogUtils.getMsg(msg), o1, o2);
}
}
public static void debug(Object msg, Object[] obj, Logger logger) {
public static void debug(Object msg, Object[] obj) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isDebugEnabled()) {
logger.debug(LogUtils.getMsg(msg), obj);
}
}
public static void warn(Object msg, Logger logger) {
public static void warn(Object msg) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isWarnEnabled()) {
logger.warn(LogUtils.getMsg(msg));
}
}
public static void warn(Object msg, Object o, Logger logger) {
public static void warn(Object msg, Object o) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isWarnEnabled()) {
logger.warn(LogUtils.getMsg(msg), o);
}
}
public static void warn(Object msg, Object o1, Object o2, Logger logger) {
public static void warn(Object msg, Object o1, Object o2) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isWarnEnabled()) {
logger.warn(LogUtils.getMsg(msg), o1, o2);
}
}
public static void warn(Object msg, Object[] obj, Logger logger) {
public static void warn(Object msg, Object[] obj) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isWarnEnabled()) {
logger.warn(LogUtils.getMsg(msg), obj);
}
}
public static void error(Object msg, Logger logger) {
public static void error(Object msg) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg));// 并追加方法名称
}
}
public static void error(Throwable e, Logger logger) {
public static void error(Throwable e) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(e), e);// 同时打印错误堆栈信息
}
}
public static void error(Object msg, Object o, Logger logger) {
public static void error(Object msg, Object o) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg), o);
}
}
public static void error(Object msg, Object o1, Object o2, Logger logger) {
public static void error(Object msg, Object o1, Object o2) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg), o1, o2);
}
}
public static void error(Object msg, Object[] obj, Logger logger) {
public static void error(Object msg, Object[] obj) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg), obj);
}
}
public static void error(Object msg, Throwable ex, Logger logger) {
public static void error(Object msg, Throwable ex) {
Logger logger = LogUtils.getLogger();
if (logger != null && logger.isErrorEnabled()) {
logger.error(LogUtils.getMsg(msg), ex);
}
@ -134,7 +179,7 @@ public class LogUtils {
String str = "";
if (msg != null) {
str = LogUtils.getLogMethod() + "[" + msg + "]";
str = LogUtils.getLogMethod() + "[" + msg.toString() + "]";
} else {
str = LogUtils.getLogMethod() + "[null]";
}
@ -149,6 +194,22 @@ public class LogUtils {
return LogUtils.getMsg(msg, null);
}
/**
* 得到调用类名称
*
* @return
*/
private static String getLogClass() {
String str = "";
StackTraceElement[] stack = (new Throwable()).getStackTrace();
if (stack.length > 3) {
StackTraceElement ste = stack[3];
str = ste.getClassName();// 类名称
}
return str;
}
/**
* 得到调用方法名称
@ -157,11 +218,38 @@ public class LogUtils {
*/
private static String getLogMethod() {
String str = "";
StackTraceElement[] stack = (new Throwable()).getStackTrace();
if (stack.length > 4) {
StackTraceElement ste = stack[4];
str = "Method[" + ste.getMethodName() + "]";// 方法名称
}
return str;
}
public static String toString(Throwable e) {
try (StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);) {
//将出错的栈信息输出到printWriter中
e.printStackTrace(pw);
pw.flush();
sw.flush();
return sw.toString();
} catch (IOException ex) {
return ex.getMessage();
}
}
public static String getExceptionDetailsToStr(Exception e) {
StringBuilder sb = new StringBuilder(e.toString());
StackTraceElement[] stackElements = e.getStackTrace();
for (StackTraceElement stackTraceElement : stackElements) {
sb.append(stackTraceElement.toString());
sb.append(StringUtils.LF);
}
sb.append(StringUtils.LF);
return sb.toString();
}
}

View File

@ -3,8 +3,7 @@ package io.metersphere.api.jmeter;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.StackTraceElementProxy;
import ch.qos.logback.core.UnsynchronizedAppenderBase;
import io.metersphere.api.utils.ApiLogUtils;
import io.metersphere.api.utils.FixedCapacityUtils;
import io.metersphere.api.util.FixedCapacityUtils;
import io.metersphere.sdk.util.DateUtils;
import io.metersphere.sdk.util.LogUtils;
import org.apache.commons.lang3.StringUtils;
@ -38,7 +37,7 @@ public class JMeterLoggerAppender extends UnsynchronizedAppenderBase<ILoggingEve
}
}
} catch (Exception e) {
ApiLogUtils.error(e);
LogUtils.error(e);
}
}
}

View File

@ -1,4 +1,4 @@
package io.metersphere.api.utils;
package io.metersphere.api.util;
import org.apache.commons.lang3.StringUtils;

View File

@ -1,93 +0,0 @@
package io.metersphere.api.utils;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ApiLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("api-test");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.load.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LoadLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("load-test");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,87 +0,0 @@
package io.metersphere.project.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ProjectLogUtils extends LogUtils {
public static Logger getLogger() {
return LoggerFactory.getLogger("project-management");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.system.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SystemLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("system-setting");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.plan.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PlanLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("test-plan");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.track.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class TrackLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("test-track");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.ui.util;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UiLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("ui-test");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}

View File

@ -1,93 +0,0 @@
package io.metersphere.workstation.utils;
import io.metersphere.sdk.util.LogUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class WorkstationLogUtils extends LogUtils {
/**
* 初始化日志
*
* @return
*/
public static Logger getLogger() {
return LoggerFactory.getLogger("workstation");
}
public static void writeLog(Object msg, String level) {
writeLog(msg, level, getLogger());
}
public static void info(Object msg) {
info(msg, getLogger());
}
public static void info(Object msg, Object o1) {
info(msg, o1, getLogger().atError());
}
public static void info(Object msg, Object o1, Object o2) {
info(msg, o1, o2, getLogger());
}
public static void info(Object msg, Object[] obj) {
info(msg, obj, getLogger());
}
public static void debug(Object msg) {
debug(msg, getLogger());
}
public static void debug(Object msg, Object o) {
debug(msg, o, getLogger());
}
public static void debug(Object msg, Object o1, Object o2) {
debug(msg, o1, o2, getLogger());
}
public static void debug(Object msg, Object[] obj) {
debug(msg, obj, getLogger());
}
public static void warn(Object msg) {
warn(msg, getLogger());
}
public static void warn(Object msg, Object o) {
warn(msg, o, getLogger());
}
public static void warn(Object msg, Object o1, Object o2) {
warn(msg, o1, o2, getLogger());
}
public static void warn(Object msg, Object[] obj) {
warn(msg, obj, getLogger());
}
public static void error(Object msg) {
error(msg, getLogger());
}
public static void error(Throwable e) {
error(e, getLogger());
}
public static void error(Object msg, Object o) {
error(msg, o, getLogger());
}
public static void error(Object msg, Object o1, Object o2) {
error(msg, o1, o2, getLogger());
}
public static void error(Object msg, Object[] obj) {
error(msg, obj, getLogger());
}
public static void error(Object msg, Throwable ex) {
error(msg, ex, getLogger());
}
}