前端之家收集整理的这篇文章主要介绍了
log4j2.xml 模板,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
log4j2.xml 模板
<?xml version="1.0" encoding="UTF-8" ?>
<configuration verbose="true" monitorInterval="10">
<properties>
<property name="log4j.level">debug</property>
<property name="file.stdfile">out.log</property>
</properties>
<appenders>
<RollingFile name="stdfile" fileName="${sys:home}/logs/${sys:file.stdfile}"
filePattern="${sys:home}/logs/$${date:yyyy-MM}/cr-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout charset="utf-8" pattern="%d{EDT} %-5p (%c:%L) [%t] - %m%n" />
<SizeBasedTriggeringPolicy size="20MB" />
</RollingFile>
<RollingFile name="dbperf" fileName="${sys:home}/logs/${sys:file.dbperf}"
filePattern="${sys:home}/logs/$${date:yyyy-MM}/dbperf-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout charset="utf-8" pattern="%d{EDT} - %m%n" />
<SizeBasedTriggeringPolicy size="20MB" />
</RollingFile>
</appenders>
<loggers>
<!-- additivity set to false means that don't write log to parent appender,default is true-->
<logger name="com.fudy" level="${sys:log4j.level}" additivity="false">
<appender-ref ref="stdfile" />
</logger>
<logger name="com.fudy.procedure.Procedure" level="INFO" additivity="false">
<appender-ref ref="stdfile" />
</logger>
<root level="${sys:log4j.level}">
<appender-ref ref="stdfile" />
</root>
</loggers>
</configuration>