LogBack,升级版的log4J

时间:2022-11-09 21:49:41

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="LOG-ALL" class="org.apache.log4j.DailyRollingFileAppender">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="file" value="${logpath}/all.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %6p - %30.30c - %m \n"/>
</layout>
</appender>

<appender name="LOG-CONFIG" class="org.apache.log4j.DailyRollingFileAppender">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="file" value="${logpath}/config.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %6p - %30.30c - %m \n"/>
</layout>
</appender>

<category name="com.vh.app.server.vgb.controller.config" additivity="false">
<priority value="${loglevel}" />
<appender-ref ref="LOG-CONFIG" />
</category>

<appender name="LOG-MONITOR" class="org.apache.log4j.DailyRollingFileAppender">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="file" value="${logpath}/monitor.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %6p - %30.30c - %m \n"/>
</layout>
</appender>

<category name="com.vh.app.server.vgb.check" additivity="false">
<priority value="${loglevel}" />
<appender-ref ref="LOG-MONITOR" />
</category>

<appender name="LOG-WORKFLOW" class="org.apache.log4j.DailyRollingFileAppender">
<param name="DatePattern" value="'.'yyyy-MM-dd"/>
<param name="file" value="${logpath}/workflow.log"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss}] %6p - %30.30c - %m \n"/>
</layout>
</appender>

<category name="com.vh.app.server.vgb.service.flow" additivity="false">
<priority value="${loglevel}" />
<appender-ref ref="LOG-WORKFLOW" />
</category>

<root>
<priority value="${loglevel}"/>
<appender-ref ref="LOG-ALL"/>
</root>
</log4j:configuration>