Commit 8c46b10a authored by lihaipeng's avatar lihaipeng

modify

parent 403b95ef
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<dependency> <dependency>
<groupId>com.alibaba.nacos</groupId> <groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId> <artifactId>nacos-client</artifactId>
<version>1.3.1</version> <version>1.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
......
...@@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit; ...@@ -21,7 +21,7 @@ import java.util.concurrent.TimeUnit;
@Aspect @Aspect
@Component @Component
public class ControllerLogAspect { public class ControllerLogAspect {
private final static Logger logger = LoggerFactory.getLogger("ControllerAspectLog"); private final static Logger logger = LoggerFactory.getLogger("ControllerLog");
@Autowired @Autowired
private UnififiProperties unififiProperties; private UnififiProperties unififiProperties;
...@@ -44,7 +44,7 @@ public class ControllerLogAspect { ...@@ -44,7 +44,7 @@ public class ControllerLogAspect {
} }
if (logger.isInfoEnabled() && unififiProperties.getLogger().getController().isEnabled()) { if (logger.isInfoEnabled() && unififiProperties.getLogger().getController().isEnabled()) {
if (!unififiProperties.getLogger().getController().getSkipMethodSigns().contains(pjp.getSignature().toShortString())) { if (!unififiProperties.getLogger().getController().getSkipMethodSigns().contains(pjp.getSignature().toShortString())) {
logger.info("Unififi-REQ-[{}] {}", pjp.getSignature().toShortString(), (requestData != null ? requestData : "")); logger.info("UNIFIFI-REQ-[{}] {}", pjp.getSignature().toShortString(), (requestData != null ? requestData : ""));
} }
} }
Object result = pjp.proceed(); Object result = pjp.proceed();
...@@ -56,16 +56,16 @@ public class ControllerLogAspect { ...@@ -56,16 +56,16 @@ public class ControllerLogAspect {
if (logger.isInfoEnabled() && unififiProperties.getLogger().getController().isEnabled()) { if (logger.isInfoEnabled() && unififiProperties.getLogger().getController().isEnabled()) {
if (!unififiProperties.getLogger().getController().getSkipMethodSigns().contains(pjp.getSignature().toShortString())) { if (!unififiProperties.getLogger().getController().getSkipMethodSigns().contains(pjp.getSignature().toShortString())) {
if (unififiProperties.getLogger().getController().getIgnoreResponseDataMethodSigns().contains(pjp.getSignature().toShortString())) { if (unififiProperties.getLogger().getController().getIgnoreResponseDataMethodSigns().contains(pjp.getSignature().toShortString())) {
logger.info("Unififi-RESP-[{}] IGNORE_DATA size:{} spend:{}ms", pjp.getSignature().toShortString(), (responseData != null ? responseData.length() : 0), elapsedTime); logger.info("UNIFIFI-RESP-[{}] IGNORE_DATA size:{} spend:{}ms", pjp.getSignature().toShortString(), (responseData != null ? responseData.length() : 0), elapsedTime);
} else { } else {
logger.info("Unififi-RESP-[{}] {} size:{} spend:{}ms", pjp.getSignature().toShortString(), (responseData != null ? responseData : ""), (responseData != null ? responseData.length() : 0), elapsedTime); logger.info("UNIFIFI-RESP-[{}] {} size:{} spend:{}ms", pjp.getSignature().toShortString(), (responseData != null ? responseData : ""), (responseData != null ? responseData.length() : 0), elapsedTime);
} }
} }
} }
return result; return result;
} catch (Throwable throwable) { } catch (Throwable throwable) {
if (logger.isErrorEnabled() && unififiProperties.getLogger().getController().isEnabled()) { if (logger.isErrorEnabled() && unififiProperties.getLogger().getController().isEnabled()) {
logger.error("Unififi-RESP-[{}] {}: {}", pjp.getSignature().toShortString(), throwable.getClass().getSimpleName(), throwable.getMessage()); logger.error("UNIFIFI-RESP-[{}] [{}]{}", pjp.getSignature().toShortString(), throwable.getClass().getSimpleName(), throwable.getMessage());
} }
return throwable; return throwable;
} }
......
...@@ -26,7 +26,7 @@ public class UnififiFeignLogger extends feign.Logger { ...@@ -26,7 +26,7 @@ public class UnififiFeignLogger extends feign.Logger {
protected void logRequest(String configKey, Level logLevel, Request request) { protected void logRequest(String configKey, Level logLevel, Request request) {
if (logger.isInfoEnabled() && setting.isEnabled()) { if (logger.isInfoEnabled() && setting.isEnabled()) {
if (!setting.getSkipMethodSigns().contains(configKey)) { if (!setting.getSkipMethodSigns().contains(configKey)) {
logger.info("FEIGN-REQ-[{}] {} --> {} {}", configKey, request.body() != null ? new String(request.body(), Charsets.UTF_8) : "", request.httpMethod(), request.url()); logger.info("FEIGN-REQ-[{}] {}-->{} {}", configKey, request.body() != null ? new String(request.body(), Charsets.UTF_8) : "", request.httpMethod(), request.url());
} }
} }
} }
...@@ -58,7 +58,7 @@ public class UnififiFeignLogger extends feign.Logger { ...@@ -58,7 +58,7 @@ public class UnififiFeignLogger extends feign.Logger {
@Override @Override
protected IOException logIOException(String configKey, Level logLevel, IOException ioe, long elapsedTime) { protected IOException logIOException(String configKey, Level logLevel, IOException ioe, long elapsedTime) {
if (logger.isErrorEnabled() && setting.isEnabled()) { if (logger.isErrorEnabled() && setting.isEnabled()) {
logger.error("FEIGN-RESP-[{}] {}: {}", configKey, ioe.getClass().getSimpleName(), ioe.getMessage()); logger.error("FEIGN-RESP-[{}] [{}]{}", configKey, ioe.getClass().getSimpleName(), ioe.getMessage());
} }
return ioe; return ioe;
} }
......
...@@ -30,7 +30,7 @@ public class RestTemplateLogInterceptor implements ClientHttpRequestInterceptor ...@@ -30,7 +30,7 @@ public class RestTemplateLogInterceptor implements ClientHttpRequestInterceptor
if (logger.isInfoEnabled() && setting.isEnabled()) { if (logger.isInfoEnabled() && setting.isEnabled()) {
if (!setting.getSkipMethodSigns().contains(methodTag)) { if (!setting.getSkipMethodSigns().contains(methodTag)) {
logger.info("REST-REQ-[{}] {} --> {} {}", methodTag, body != null ? new String(body, Charsets.UTF_8) : "", request.getMethod(), request.getURI()); logger.info("REST-REQ-[{}] {}-->{} {}", methodTag, body != null ? new String(body, Charsets.UTF_8) : "", request.getMethod(), request.getURI());
} }
} }
long start = System.nanoTime(); long start = System.nanoTime();
...@@ -63,7 +63,7 @@ public class RestTemplateLogInterceptor implements ClientHttpRequestInterceptor ...@@ -63,7 +63,7 @@ public class RestTemplateLogInterceptor implements ClientHttpRequestInterceptor
} }
} catch (IOException ioe) { } catch (IOException ioe) {
if (logger.isErrorEnabled() && setting.isEnabled()) { if (logger.isErrorEnabled() && setting.isEnabled()) {
logger.error("REST-RESP-[{}] {}: {}", methodTag, ioe.getClass().getSimpleName(), ioe.getMessage()); logger.error("REST-RESP-[{}] [{}]{}", methodTag, ioe.getClass().getSimpleName(), ioe.getMessage());
} }
throw ioe; throw ioe;
} }
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<dependency> <dependency>
<groupId>com.alibaba.nacos</groupId> <groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId> <artifactId>nacos-client</artifactId>
<version>1.3.1</version> <version>1.3.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment