Spring boot:logback文件配置
resources文件夹下:新建logback-spring.xml文件。
文件内容like:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration> <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} : %msg%n
</pattern>
</layout> </appender> <appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>ACCEPT</onMismatch>
</filter>
<encoder>
<pattern>
${FILE_LOG_PATTERN:-%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } -- %-40.40logger{39} : %m%n}}
</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>D:/log/info.%d.log</fileNamePattern>
</rollingPolicy>
</appender> <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>
%msg%n
</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>D:/log/error.%d.log</fileNamePattern>
</rollingPolicy>
</appender> <root level="info">
<appender-ref ref="consoleLog"/>
<appender-ref ref="fileInfoLog"/>
<appender-ref ref="fileErrorLog"/>
</root> </configuration> 详情文档参考:https://wenku.baidu.com/view/71a056eb0975f46527d3e138.html
Spring boot:logback文件配置的更多相关文章
- Spring Boot Logback 默认配置
Spring Boot Logback 默认配置 标签(空格分隔): Spring Boot Intro(介绍) Spring Boot 1.5.9 默认使用的日志框架是 Logback. 生效的默认 ...
- Spring Boot属性文件配置文档(全部)
This sample file is meant as a guide only. Do not copy/paste the entire content into your applicatio ...
- Spring Boot Logback日志配置
logback的使用: Logback的默认配置 如果配置文件 logback-test.xml 和 logback.xml 都不存在,那么 logback 默认地会调用BasicConfigurat ...
- spring 及 spring boot 资源文件配置
Spring配置文件引入xml文件: <import resource=" " />标签使用总结 https://www.cnblogs.com/javahr/p/83 ...
- spring boot 日志文件配置(logback-spring.xml)亲测可用!
问题描述:如何配置springboot项目,通过日志配置,使之输出自定义日志. 详细文章:https://blog.csdn.net/gebitan505/article/details/701421 ...
- spring boot资源文件配置读取
一般业务配置,尽量新建自己的配置文件,来读取,而不是配置在application.properties或application-*.properties或yml/yaml配置中. applicatio ...
- (转)Spring boot——logback.xml 配置详解(四)<filter>
文章转载自:http://aub.iteye.com/blog/1101260,在此对作者的辛苦表示感谢! 1 filter的使用 <filter>: Logback的过滤器基于三值逻辑( ...
- (转)Spring boot——logback.xml 配置详解(三)<appender>
文章转载自:http://aub.iteye.com/blog/1101260,在此对作者的辛苦表示感谢! 1 appender <appender>是<configuration& ...
- (转)Spring boot——logback.xml 配置详解(二)
文章转载自:http://aub.iteye.com/blog/1101260,在此对作者的辛苦表示感谢! 1 根节点<configuration>包含的属性 scan: 当此属性设置为t ...
- Spring boot——logback.xml 配置详解(四)<filter>
阅读目录 1 filter的使用 2 常用的过滤器 文章转载自:http://aub.iteye.com/blog/1101260,在此对作者的辛苦表示感谢! 回到顶部 1 filter的使用 < ...
随机推荐
- atitit.自动生成数据库结构脚本,或者更换数据库,基于hibernate4
atitit.自动生成数据库结构脚本,或者更换数据库,基于hibernate4 目前近况:: 更换数据库,但是是使用spring集成的. <!-- hibernate配置文件路径 --> ...
- spring 学习资料备份
易百教程 https://www.yiibai.com/spring/spring-autowiring-by-name.html
- 在CentOS上安装部署MooseFS分布式文件系统
参考资料: http://www.moosefs.org/tl_files/manpageszip/moosefs-step-by-step-tutorial-cn-v.1.1.pdf 环境介绍:OS ...
- 动态更新highcharts数据
<!doctype html> <html> <head> <script type="text/javascript" src=&quo ...
- PKI/CA
PKI( Public Key Infrastructure )指的是公钥基础设施. CA ( Certificate Authority )指的是认证中心. PKI从技术上解决了网络通信安全的种种障 ...
- python内置函数之dict()
class dict(**kwargs) 返回一个字典.本方法用来创建一个字典对象.只能传入一个参数. >>> dict(a=1) {'a': 1} 也可以传入映射函数作为参数 &g ...
- Eclipse 最有用的快捷键
Eclipse中10个最有用的快捷键组合 一个Eclipse骨灰级开发者总结了他认为最有用但又不太为人所知的快捷键组合.通过这些组合可以更加容易的浏览源代码,使得整体的开发效率和质量得到提升. ...
- FreeRTOS——1
以下转载自安富莱电子: http://forum.armfly.com/forum.php FreeRTOS 的特点 FreeRTOS 的主要特点如下:1. 支持抢占式调度,合作式调度和时间片调度.2 ...
- lua工具库penlight--03字符串
字符串提取函数 这些方法也是从Python借鉴来的,但索引从1开始.stringx定义了一些函数如isalpha和isdigit, 用来判断字母和数字:startswith和endswith可以方便用 ...
- spark源码 hashpartitioner
def nonNegativeMod(x: Int, mod: Int): Int = { val rawMod = x % mod rawMod + () mod ) def getPartitio ...