<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="DEBUG" strict="true" name="extFrameworkSynGW"
packages="aaa.bbb.ccc">
<Properties>
<Property name="filename">logs/appName/appName.log</Property>
<Property name="pattern">%d %p %C [%t] %m%n</Property>
</Properties>
<ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="${pattern}"/>
</Console>
<RollingFile name="RollingFile" fileName="${filename}"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="${pattern}"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="250 MB"/>
</Policies>
<DefaultRolloverStrategy max="366"/><!--保存一年的日志-->
</RollingFile>
</Appenders>
<Loggers>
<Logger name="aaa.bbb.ccc" level="DEBUG" additivity="false">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.apache.ibatis.logging.jdbc.BaseJdbcLogger" level="DEBUG" additivity="false">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="Console"/>
</Logger>
<Logger name="org.springframework.boot.logging" level="INFO" additivity="false">
<AppenderRef ref="RollingFile"/>
<AppenderRef ref="Console"/>
</Logger>
<Root level="DEBUG">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
log4j2配置demo
最新推荐文章于 2024-04-22 10:04:07 发布