Log4jx 2.9 後支持進程號輸出

<?xml version="1.0" encoding="UTF-8" ?>
<Configuration status="WARN">
<properties>
    <property name="pattern">%d{yyyy-MM-dd HH:mm:ss} %processId [%t] %-5p %c{1}:%L - %msg%n</property>
    <property name="patternNoTime">%msg%n</property>
    <property name="patternMetrics">%d %-8r %m%n</property>
	<property name="logPath">logs</property>
</properties>

<appenders>
<RollingFile name="STDOUT"

		fileName="${logPath}/${sys:logfile.name}.log"
		filePattern="${logPath}/${sys:logfile.name}-%d{yyyy-MM-dd}.log.%i.gz">
        <PatternLayout>
            <pattern>${pattern}</pattern>
        </PatternLayout>
        <Policies>
            <SizeBasedTriggeringPolicy size="100 MB"/> <!-- Or every 100 MB -->
        </Policies>
        <DefaultRolloverStrategy max="4"/>
    </RollingFile>
	
	<RollingFile name="METRICS"
		fileName="${logPath}/${sys:logfile.name}.metrics"
		filePattern="${logPath}/${sys:logfile.name}-%d{yyyy-MM-dd}.metrics.%i.gz">
        <PatternLayout>
            <pattern>${patternMetrics}</pattern>
        </PatternLayout>
        <Policies>
            <SizeBasedTriggeringPolicy size="50 MB"/>
        </Policies>
        <DefaultRolloverStrategy max="4"/>
    </RollingFile>
	</appenders>
	
<loggers>
   <Root level="info">
    <appender-ref ref="STDOUT"/>
   </Root>
    <Logger name="com.metamx.emitter.core.LoggingEmitter" level="error" additivity="false">
        <appender-ref ref="METRICS"/>
    </Logger>
   
</loggers>
</Configuration>
相關文章
相關標籤/搜索