时间:2021-07-01 10:21:17 帮助过:19人阅读
记得加入红色这个即可。
Spring Boot的配置:
从logback.xml文件配置入手,主要是定位要打印日志的包路径,配置好打印的级别即可。
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="60 seconds"> <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%d{yyyy-M-d HH:mm:ss} %t %p %m%n</pattern> </encoder> </appender> <appender name="springboot" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- <Encoding>UTF-8</Encoding> --> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>logs/logback/springboot_%d{yyyy-M-d}.log </FileNamePattern> <MaxHistory>10</MaxHistory> </rollingPolicy> <encoder> <pattern>%d{yyyy-M-d HH:mm:ss} %t %p %m%n</pattern> </encoder> </appender> <appender name="smile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <FileNamePattern>logs/logback/smile_%d{yyyy-M-d}.log </FileNamePattern> <MaxHistory>10</MaxHistory> </rollingPolicy> <encoder> <pattern>%d{yyyy-M-d HH:mm:ss} %t %p %m%n</pattern> </encoder> </appender> <logger name="org.springframework.boot" level="debug" additivity="false"> <appender-ref ref="springboot" /> </logger> <!-- name包必须能够扫描到所以类,包括启动类 --> <logger name="com.smile" level="debug" additivity="false"> <appender-ref ref="smile" /> </logger> <root level="info"> <appender-ref ref="stdout" /> </root> </configuration>
小提示:如果想在Eclipse的控制台打印出日志,那么把additivity="false"改为true,这个是为了重复打印日志的选项设置,false为只打印文件。
参考:
http://blog.csdn.net/fan510988896/article/details/67638067(以上内容转自此篇文章)
http://blog.csdn.net/fan510988896/article/details/54409790(以上内容转自此篇文章)
Spring Boot使用MyBatis 3打印SQL的配置
标签:eclips mapping cache art core ring 关联 roo 主键