springboot学习笔记(二)日志配置

来源:互联网 发布:手机电视下载软件 编辑:程序博客网 时间:2024/04/30 03:01

1.创建资源文件



设置日志参数:

logging.file=log.log  logging.level.com.xiaofangtech.sunt.controller = debug  logging.level.com.xiaofangtech.sunt.helper = warn  



测试类:

/** * Test_myspringboot * Controller_test.java */package com.springboot.Test_myspringboot;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/** * @author xuchuang * @updateTime 2017年12月20日 下午3:38:31 */@RestControllerpublic class Controller_test {  private final Logger logger = LoggerFactory.getLogger(this.getClass());     @RequestMapping("/hello")    String home() {    logger.debug("This is a debug message");          logger.info("This is an info message");          logger.warn("This is a warn message");          logger.error("This is an error message");          return "Hello World!";    }}


启动后访问 localhost:6636/hello

查看控制台:






阅读全文
0 0
原创粉丝点击