logback.xml 3.04 KB
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

	<!-- web 日志 -->
	<appender name="ORDERS-WEB"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<!-- <file>${catalina.base}/logs/orders_web.log</file> -->
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>${catalina.base}/logs/%d{yyyy-MM-dd}/orders_web.%i.log.zip
			</FileNamePattern>
			<MaxHistory>30</MaxHistory>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>5MB</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
		</rollingPolicy>
		<encoder>
			<pattern>[orders-web] %date %-5level [%thread] %logger{36}
				[%file:%line] %msg%n</pattern>
		</encoder>
	</appender>

	<!-- api 接口日志 -->
	<appender name="ORDERS-API"
		class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>${catalina.base}/logs/api/orders_api.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<FileNamePattern>${catalina.base}/logs/api/%d{yyyy-MM-dd}/orders_api_%i.log.zip
			</FileNamePattern>
			<maxHistory>30</maxHistory>
			<timeBasedFileNamingAndTriggeringPolicy
				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<maxFileSize>5MB</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
		</rollingPolicy>
		<encoder>
			<pattern>[orders-api] %date %-5level [%thread] %logger{36}
				[%file:%line] %msg%n</pattern>
		</encoder>
	</appender>
	<logger name="com.b2c.dtms.web.restful" level="INFO" additivity="false">
		<appender-ref ref="ORDERS-API" />
	</logger>
	<logger name="com.b2c.dtms.web.common.ApiCallMonitorAspect"
		level="INFO" additivity="false">
		<appender-ref ref="ORDERS-API" />
	</logger>
	<logger name="com.b2c.dtms.service.restful.impl" level="INFO"
		additivity="false">
		<appender-ref ref="ORDERS-API" />
	</logger>

	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>[orders] %d{yyyy-MM-dd HH:mm:ss.SSS}:[%thread] %-5level
				%logger{36} - %msg%n</pattern>
		</encoder>
	</appender>
	<logger name="com.b2c.dtms.dao" level="INFO">
		<appender-ref ref="ORDERS-WEB" />
	</logger>
	<logger name="org.apache.ibatis" level="DEBUG">
		<appender-ref ref="STDOUT" />
	</logger>
	<logger name="com.ibatis" level="DEBUG" />
	<logger name="com.ibatis.common.jdbc.SimpleDataSource" level="DEBUG" />
	<logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG" />
	<logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate"
		level="DEBUG" />
	<logger name="java.sql.Connection" level="DEBUG" />
	<logger name="java.sql.Statement" level="DEBUG" />
	<logger name="java.sql.PreparedStatement" level="DEBUG" />

	<root level="INFO">
		<!-- <appender-ref ref="ORDERS-WEB" /> -->
		<appender-ref ref="STDOUT" />
		<appender-ref ref="org.apache.ibatis" />
		<appender-ref ref="com.ibatis.common" />
		<appender-ref ref="com.ibatis.common.jdbc.ScriptRunner" />
		<appender-ref ref="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" />
		<appender-ref ref="java.sql" />
	</root>
</configuration>