美文网首页
3、spring-boot 简单日志管理

3、spring-boot 简单日志管理

作者: 内酷啦啦 | 来源:发表于2017-07-14 16:29 被阅读0次
    第一步添加依赖
    <!-- 日志工具 -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    
    第二步添加mapping
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @RequestMapping("/writelog")
    public Object writeLog()
    {
        logger.info("日志输出!");
        return "OK";
    }
    
    第三步运行,输入http://localhost:8080/writelog,控制台输出日志
    添加配置文件application.properties
    #日志管理
    logging.file=../../webLog.log
    logging.level.cn.com.cn.com.flybiner.controller.controller = debug
    

    结果日志输出在项目文件夹下


    相关文章

      网友评论

          本文标题:3、spring-boot 简单日志管理

          本文链接:https://www.haomeiwen.com/subject/leqohxtx.html