log4j2.xml 配置

 

 

 

<?xml version="1.0" encoding="UTF-8" ?>
<Configuration monitorInterval="60">
	<Properties>
		<Property name="logpath">/home/aoi/sh-msgsender</Property>
		<Property name="wkjslogpath">/data</Property>
	</Properties>
	<Appenders>
		<Console name="stdout" target="SYSTEM_OUT">
			<ThresholdFilter level="info" onMatch="ACCEPT"
				onMismatch="DENY" />
			<PatternLayout pattern="%-d{ABSOLUTE} [%c]-[%p] %m%n" />
		</Console>
		<RollingFile name="RollingFile" fileName="${logpath}/logs/msgsender.log"
			filePattern="${logpath}/logs/msgsender-%d{yyyyMMddHH}.log">
			<PatternLayout pattern="[%-5p] %d %c - %m%n" />
			<Policies>
				<TimeBasedTriggeringPolicy />
			</Policies>
			<DefaultRolloverStrategy max="20" />
			<bufferedIO>true</bufferedIO>
			<bufferSize>16384</bufferSize>
		</RollingFile>
		
		<RollingFile name="IOSRollingFile" fileName="${wkjslogpath}/logs/ios.log"
                     filePattern="${wkjslogpath}/logs/ios.log.%d{yyyyMMddHH00}">
            <Filters>
                <ThresholdFilter level="INFO"/>
            </Filters>
            <PatternLayout pattern="%m%n" />
            <Policies>
                <TimeBasedTriggeringPolicy interval="1" modulate="true" />
            </Policies>
        </RollingFile>
		
		<Async name="async">
			<bufferSize>1024</bufferSize>
			<AppenderRef ref="stdout" />
			<AppenderRef ref="RollingFile" />
		</Async>
	</Appenders>
	<Loggers>
	   <logger name="IosMsgLogger" level="info" additivity="false">  
           <appender-ref ref="IOSRollingFile"/>  
       </logger>
		<Logger name="org.apache.log4j.xml" level="debug">
			<AppenderRef ref="stdout" />
			<AppenderRef ref="RollingFile" />
		</Logger>
		<Root level="debug">
			<AppenderRef ref="stdout" />
			<AppenderRef ref="RollingFile" />
		</Root>
	</Loggers>
</Configuration>

 

你可能感兴趣的:(xml,配置,log4j2)