1.添加依赖
org.projectlombok lombok 1.16.10
2.添加日志
package com.example.demo.controller;/** * @author duanxiaoqiu * @Date 2019-06-14 15:05 **/import lombok.extern.slf4j.Slf4j;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;@Slf4j@Controller@RequestMapping("/")public class TestController { @RequestMapping("/") @ResponseBody public String index(){ log.info("++++"); return "hello world"; }}
3.logback文件
4.文件内容
logback info ${LOG_PATTERN} ${FILE_PATH} true ${LOG_PATTERN}