多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
~~~ logging: level: com.like: debug #key是包名,值是级别 ~~~ ## 日志级别 `TRACE`<`DEBUG`<`INFO`<`WARN`<`ERROR`<`FATAL`。 如果设置为`WARN`,则低于`WARN`的信息都不会输出。 `Spring Boot`中默认配置`ERROR`、`WARN`和`INFO`级别的日志输出到控制台。 ~~~ //使用注解代替下面的的实例化slf4j方式,log变量spring帮我们声明了 @Slf4j public class MyInterceptor implements HandlerInterceptor { //使用slf4j日志 // private static final Logger log = LoggerFactory.getLogger(MyInterceptor.class); //传入类 @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { log.debug("preHandle running"); return true; } @Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { log.debug("postHandle running"); } @Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { log.debug("afterCompletion running"); } } ~~~