diff --git a/src/main/java/com/kwan/springbootkwan/controller/UserController.java b/src/main/java/com/kwan/springbootkwan/controller/UserController.java index 1d43e7e5c8dc130ab743e5619ffc9b77956cef5e..65e944e1a74693b027a6415be563d16aff6d0c0d 100644 --- a/src/main/java/com/kwan/springbootkwan/controller/UserController.java +++ b/src/main/java/com/kwan/springbootkwan/controller/UserController.java @@ -4,6 +4,7 @@ import com.kwan.springbootkwan.entity.User; import com.kwan.springbootkwan.service.IUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -16,6 +17,7 @@ import java.util.List; * @version : 2.2.0 * @date : 2022/12/19 16:08 */ +@Slf4j @Api(description = "用户信息", tags = "UserController") @RestController @RequestMapping("/user") @@ -27,6 +29,7 @@ public class UserController { @ApiOperation(value = "获取所有用户", notes = "获取所有用户") @RequestMapping(value = "/all", method = RequestMethod.GET) public List addAdvertise() { + log.info("测试日志={}", "success"); return userService.getUsers(); } diff --git a/src/main/resources/application.yaml b/src/main/resources/application.yaml index b8c6909a92c25c555ee19a736b4d25af8d080646..eafea58a50cc9d80e1d324e671f3f120efef79ca 100644 --- a/src/main/resources/application.yaml +++ b/src/main/resources/application.yaml @@ -43,4 +43,8 @@ mybatis-plus: logic-delete-field: delFlag logic-delete-value: 1 logic-not-delete-value: 0 - table-underline: true \ No newline at end of file + table-underline: true + +#logger配置 +logging: + config: classpath:logback-spring.xml \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000000000000000000000000000000000000..86327aa5ccd3adb3f51a9e3be026eb4ed5ad50b1 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + ../logs/springboot-mybatis.log + + + %date [%level] [%thread] %logger{60} [%file : %line] %msg%n + + UTF-8 + + + + + ../logs/springboot-mybatis.log.%d{yyyy-MM-dd}.log + + 30 + + 10GB + + + + + + + ../logs/error.log + + %date [%level] [%thread] %logger{60} [%file : %line] %msg%n + + UTF-8 + + + + + ../logs/error.%d{yyyy-MM-dd}.log + + 30 + + 10GB + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + \ No newline at end of file