<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="30">
	<properties>
		<property name="LOG_HOME">${sys:LOGDIR}</property>
		<property name="svr">${sys:svr}</property>
		<property name="Seq">${sys:Seq}</property>
		<property name="PATTERN_LAYOUT">%d [%20X{MWMS.MSGNAME}] [%20X{MWMS.TRXID}][%-5p] [%t] %C{2} (%F:%L) - %m%n</property>
	</properties>
	<Appenders>
		<Console name="Console" target="SYSTEM_OUT">
			<PatternLayout  pattern="${PATTERN_LAYOUT}" />
		</Console>
		<!-- name: 指定appender的名字 fileName：日志存储路径 filePattern：历史日志封存路径, 当发生Rolling时，文件的转移和重命名规则。 -->
		<RollingRandomAccessFile name="file"
			fileName="${LOG_HOME}/${svr}/${Seq}"
			filePattern="${LOG_HOME}/${svr}/%d{yyyyMMdd}/${Seq}_%d{yyyyMMddHH}_%i.log">

			<PatternLayout  pattern="${PATTERN_LAYOUT}" />

			<Policies>
				<!-- interval:表示历史日志封存间隔时间，单位为filePattern设置的单位值  -->
				<TimeBasedTriggeringPolicy interval="1" />
				<!-- 指定当文件体积大于size值时，触发Rolling -->
				<SizeBasedTriggeringPolicy size="40M" />
			</Policies>

			<!-- 指定了当触发rollover时的默认策略 -->
			<!-- max参数是与filePattern中的计数器%i配合才起作用 -->
			<DefaultRolloverStrategy max="40" />
		</RollingRandomAccessFile>

		<RollingRandomAccessFile name="error"
			fileName="${LOG_HOME}/${svr}/${Seq}_Error"
			filePattern="${LOG_HOME}/${svr}/%d{yyyyMMdd}/${Seq}_Error_%d{yyyyMMdd}_%i.log">
			<Filters>
				<ThresholdFilter level="ERROR" />
			</Filters>
			<PatternLayout pattern="${PATTERN_LAYOUT}" />
			<Policies>
				<TimeBasedTriggeringPolicy interval="1" />
				<SizeBasedTriggeringPolicy size="40MB" />
			</Policies>
			<DefaultRolloverStrategy max="20" />
		</RollingRandomAccessFile>

	</Appenders>
	<Loggers>
		<Logger name="org.springframework" level="info"/>
		<Logger name="com.cim.idm" level="debug" />
		<Logger name="com.cim.idm.framework.esb.tibco.DefaultRequester" level="info" />
		<Logger name="org.quartz" level="info" />
		<Logger name="com.zaxxer.hikari" level="info" />
		<Logger name="org.springframework.jdbc.datasource" level="debug"/>
		<Root level="debug" includeLocation="true">
			<AppenderRef ref="Console" />

			<AppenderRef ref="file" />
			<AppenderRef ref="error" />
		</Root>
	</Loggers>
</Configuration>