mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-04 01:52:21 +08:00
feat:日志切面完善
This commit is contained in:
parent
2e4c81dcc6
commit
28c455715c
@ -2,6 +2,7 @@ package com.youlai.admin.api;
|
||||
|
||||
import com.youlai.admin.pojo.dto.UserDTO;
|
||||
import com.youlai.common.result.Result;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -1,11 +1,13 @@
|
||||
package com.youlai;
|
||||
package com.youlai.auth;
|
||||
|
||||
import com.youlai.admin.api.UserFeignService;
|
||||
import com.youlai.mall.ums.api.MemberFeignService;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients
|
||||
@EnableFeignClients(basePackageClasses = {UserFeignService.class, MemberFeignService.class})
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class AuthApplication {
|
@ -1,11 +1,9 @@
|
||||
package com.youlai.common.web.aspect;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.youlai.common.web.pojo.domain.LoginLog;
|
||||
import com.youlai.common.web.pojo.domain.OptLog;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.logstash.logback.marker.Markers;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
@ -25,16 +23,16 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author HXR
|
||||
* @CreateTime 2021-03-01 16:47
|
||||
* @author HXR
|
||||
* @date 2021-03-01 16:47
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class OptLogAspect {
|
||||
public class LogAspect {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OptLogAspect.class);
|
||||
@Pointcut("execution(public * com.youlai..*.controller.*.*(..)) || execution(public * com.youlai.*.controller.*(..))")
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LogAspect.class);
|
||||
@Pointcut("@annotation(io.swagger.annotations.ApiOperation)")
|
||||
public void Log() {
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.youlai.common.web.config.WebMvcConfig,\
|
||||
com.youlai.common.web.exception.GlobalExceptionHandler
|
||||
com.youlai.common.web.exception.GlobalExceptionHandler,\
|
||||
com.youlai.common.web.aspect.LogAspect
|
||||
|
@ -63,7 +63,7 @@
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>DEBUG</level>
|
||||
</filter>
|
||||
<destination>${LOG_STASH_HOST}:5044</destination>
|
||||
<destination>${LOG_STASH_HOST}:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@ -101,7 +101,7 @@
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
<destination>${LOG_STASH_HOST}:5044</destination>
|
||||
<destination>${LOG_STASH_HOST}:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@ -134,7 +134,7 @@
|
||||
|
||||
<!--业务日志输出到LogStash-->
|
||||
<appender name="LOG_STASH_BUSINESS" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<destination>${LOG_STASH_HOST}:5044</destination>
|
||||
<destination>${LOG_STASH_HOST}:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@ -167,7 +167,7 @@
|
||||
|
||||
<!--接口访问记录日志输出到LogStash-->
|
||||
<appender name="LOG_STASH_RECORD" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
|
||||
<destination>${LOG_STASH_HOST}:5044</destination>
|
||||
<destination>${LOG_STASH_HOST}:4560</destination>
|
||||
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
|
||||
<providers>
|
||||
<timestamp>
|
||||
@ -211,7 +211,7 @@
|
||||
<appender-ref ref="LOG_STASH_ERROR"/>
|
||||
</root>
|
||||
|
||||
<logger name="com.youlai.common.web.aspect.OptLogAspect" level="DEBUG">
|
||||
<logger name="com.youlai.common.web.aspect.LogAspect" level="DEBUG">
|
||||
<appender-ref ref="LOG_STASH_RECORD"/>
|
||||
</logger>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user