<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%p %d{yyyy-MM-dd HH:mm:ss,SSS} (%c:%L)- %m%n" />
</layout>
</appender>
<!-- Appenders -->
<appender name="file" class="org.apache.log4j.RollingFileAppender">
<!-- 设置日志输出文件名 正式服 -->
<!-- <param name="File" value="/opt/tomcat/webapps/logs/XXX/XXX.log" /> -->
<!-- 设置日志输出文件名测试服 -->
<param name="File" value="/usr/local/tomcat/webapps/logs/XXX/XXX.log" />
<!-- 设置是否在重新启动服务时,在原有日志的基础添加新日志 .默认单个文件的大小是10M-->
<param name="Append" value="true" />
<param name="MaxBackupIndex" value="100" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%p %d{yyyy-MM-dd HH:mm:ss,SSS} (%c:%L)- %m%n" />
</layout>
</appender>
<!-- Application Loggers 打印game包下的所有数据-->
<!-- <logger name="com.game">
<level value="trace" />
</logger> -->
<logger name="org.springframework">
<level value="info" />
</logger>
<logger name="org.apache.commons">
<level value="info" />
</logger>
<!-- Root Logger -->
<root>
<!-- 这个是日志的等级,只打印info -->
<level value="info"/>
<appender-ref ref="file" />
</root>
</log4j:configuration>
网友评论