log4j-console\file appender

<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern"
                value="[ECP] %-d{yyyy-MM-dd HH:mm:ss} %p [%t] %c{1}.%M(%L) | %m%n"/>
        </layout>
</appender>  
<appender name="APPLOGFILE" class="org.apache.log4j.RollingFileAppender">
    	<param name="levelMin" value="INFO"/>
    	<param name="encoding" value="UTF-8" />
	    <param name="File" value="d:/logs/ecp.log" />
	    <param name="Append" value="true" />
	    <param name="MaxFileSize" value="10000KB" />
	    <layout class="org.apache.log4j.PatternLayout">
	      <param name="ConversionPattern" value="[ECP] %-d{yyyy-MM-dd HH:mm:ss} %-5p %-15c{1}: %m%n"/>
	    </layout>
</appender>

<root>
        <level value="INFO"/>
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="APPLOGFILE"/>
    </root>

 

你可能感兴趣的:(appender)