1.yml
说明:配置yml文件。debug、info、warn、error。
XML
logging:
level:
root: debug
2.指定某个包
XML
logging:
level:
root: info
# 设置某个包的日志级别
com.forever.controller: debug
3.分组调试
XML
logging:
# 设置分组
group:
ebank: com.forever.controller
iservice: com.alibaba
level:
root: info
# 设置某个包的日志级别
com.forever.controller: debug
4.@Slf4j
说明:@Slf4j
注解会在编译时自动生成一个名为log
的日志对象。
java
@slf4j
@RestController
@RequestMapping("/books")
public class BookController
@GetMapping
public String getById(){
System.out.println("springboct is running...");
Log.debug("debug info...");
Log.info("infoinfo...");
Log.warn("warn info...");
Log.error("error info...");
return "springboot is running...";
}
}