log4j2日志的完整配置文件信息和同步与异步的配置信息,如果在springboot中用,请先去掉默认的logback日志
文件名:log4j2.xml
xml version="1.0" encoding="UTF-8"?>
status="OFF">
name="log_pattern">%d{yyyy-MM-dd HH:mm:ss z} %-5p %c{36} %L %M - %m%x%n
name="file_name">logs/app.log
name="file_info">logs/info.log
name="rolling_file_name">logs/app-%d{yyyy-MM-dd}-%i.log.gz
name="every_file_size">10M
name="output_log_level">debug
name="Console" target="SYSTEM_OUT">
level="trace" onMatch="ACCEPT" onMismatch="DENY">
pattern="${log_pattern}">
name="log" fileName="${file_name}" append="false" >
pattern="${log_pattern}">
level="error" onMatch="ACCEPT" onMismatch="DENY">
name="logss" fileName="${file_info}" append="false" >
pattern="${log_pattern}">
level="info" onMatch="ACCEPT" onMismatch="DENY">
filePattern="logs/app1-%d{yyyy-MM-dd}-%i.log.gz">
-->
level="trace" includeLocation="true">
ref="log">
原创来源:滴一盘技术