因在服务器有问题,还原日志
This commit is contained in:
@@ -176,11 +176,6 @@
|
|||||||
<version>1.18</version>
|
<version>1.18</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.minbox.framework</groupId>
|
|
||||||
<artifactId>api-boot-starter-logging</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
package com.yxt.common.base.config.logging;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author dimengzhe
|
|
||||||
* @Date 2022/6/21 15:48
|
|
||||||
* @Description
|
|
||||||
*/
|
|
||||||
public class Log implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 3958980733637576088L;
|
|
||||||
private String serviceId;
|
|
||||||
private String requestIp;
|
|
||||||
private String serviceIp;
|
|
||||||
private String servicePort;
|
|
||||||
private Integer httpStatus;
|
|
||||||
private String requestMethod;
|
|
||||||
private String requestUri;
|
|
||||||
|
|
||||||
private Map<String, Object> requestBodyN;
|
|
||||||
private Map<String, Object> responseBodyN;
|
|
||||||
|
|
||||||
public String getRequestMethod() {
|
|
||||||
return requestMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequestMethod(String requestMethod) {
|
|
||||||
this.requestMethod = requestMethod;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRequestUri() {
|
|
||||||
return requestUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequestUri(String requestUri) {
|
|
||||||
this.requestUri = requestUri;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHttpStatus() {
|
|
||||||
return httpStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHttpStatus(Integer httpStatus) {
|
|
||||||
this.httpStatus = httpStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRequestIp() {
|
|
||||||
return requestIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequestIp(String requestIp) {
|
|
||||||
this.requestIp = requestIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServiceIp() {
|
|
||||||
return serviceIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServiceIp(String serviceIp) {
|
|
||||||
this.serviceIp = serviceIp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServicePort() {
|
|
||||||
return servicePort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServicePort(String servicePort) {
|
|
||||||
this.servicePort = servicePort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getServiceId() {
|
|
||||||
return serviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setServiceId(String serviceId) {
|
|
||||||
this.serviceId = serviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getRequestBodyN() {
|
|
||||||
return requestBodyN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequestBodyN(Map<String, Object> requestBodyN) {
|
|
||||||
this.requestBodyN = requestBodyN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<String, Object> getResponseBodyN() {
|
|
||||||
return responseBodyN;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResponseBodyN(Map<String, Object> responseBodyN) {
|
|
||||||
this.responseBodyN = responseBodyN;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
package com.yxt.common.base.config.logging;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.alibaba.fastjson.TypeReference;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.minbox.framework.logging.client.LoggingFactoryBean;
|
|
||||||
import org.minbox.framework.logging.client.notice.LoggingNotice;
|
|
||||||
import org.minbox.framework.logging.core.MinBoxLog;
|
|
||||||
import org.minbox.framework.util.JsonUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author dimengzhe
|
|
||||||
* @Date 2022/6/21 11:27
|
|
||||||
* @Description 日志模板
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class LoggingLocalNotice implements LoggingNotice {
|
|
||||||
|
|
||||||
public static final String BEAN_NAME = "loggingLocalNotice";
|
|
||||||
static Logger logger = LoggerFactory.getLogger(LoggingLocalNotice.class);
|
|
||||||
private final LoggingFactoryBean loggingFactoryBean;
|
|
||||||
|
|
||||||
public LoggingLocalNotice(LoggingFactoryBean loggingFactoryBean) {
|
|
||||||
this.loggingFactoryBean = loggingFactoryBean;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notice(MinBoxLog minBoxLog) {
|
|
||||||
if (this.loggingFactoryBean.isShowConsoleLog()) {
|
|
||||||
logger.info("=====接口开始:" + minBoxLog.getRequestUri());
|
|
||||||
Log log = new Log();
|
|
||||||
if (StringUtils.isNotBlank(minBoxLog.getRequestBody())) {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(minBoxLog.getRequestBody());
|
|
||||||
Map<String, Object> map = JSONObject.parseObject(jsonObject.toJSONString(), new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
log.setRequestBodyN(map);
|
|
||||||
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(minBoxLog.getResponseBody())) {
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(minBoxLog.getResponseBody());
|
|
||||||
Map<String, Object> map = JSONObject.parseObject(jsonObject.toJSONString(), new TypeReference<Map<String, Object>>() {
|
|
||||||
});
|
|
||||||
log.setResponseBodyN(map);
|
|
||||||
}
|
|
||||||
log.setHttpStatus(minBoxLog.getHttpStatus());
|
|
||||||
BeanUtil.copyProperties(minBoxLog, log);
|
|
||||||
// logger.info("Request Uri:{}, Logging:\n{}", minBoxLog.getRequestUri(), this.loggingFactoryBean.isFormatConsoleLog() ? JsonUtils.beautifyJson(minBoxLog) : JsonUtils.toJsonString(minBoxLog));
|
|
||||||
logger.info("Logging:\n{}", this.loggingFactoryBean.isFormatConsoleLog() ? JsonUtils.beautifyJson(log) : JsonUtils.toJsonString(log));
|
|
||||||
logger.info("====接口结束");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getOrder() {
|
|
||||||
return -2147483648;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -400,15 +400,6 @@
|
|||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--ApiBoot Logging日志管理文件-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.minbox.framework</groupId>
|
|
||||||
<artifactId>api-boot-dependencies</artifactId>
|
|
||||||
<version>2.3.3.RELEASE</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|||||||
Reference in New Issue
Block a user