logback.xml 12.5 KB
<configuration>
	<!-- 日志最大的历史 7天 -->
	<property name="yoho.logs.maxHistory" value="7" />
	<!-- 日志最大的文件大小 10MB -->
	<property name="yoho.logs.maxFileSize" value="10MB" />
	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
		<encoder>
			<pattern>[%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}] - %-5level [%thread] %logger{35} - %m%n</pattern>
		</encoder>
	</appender>
	<appender name="DEBUG_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">

		<file>/Data/logs/ufo-gateway/debug.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/debug.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>100MB</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>30</maxHistory>
		</rollingPolicy>

		<encoder>
			<pattern>[%X{X-B3-TraceId:-},%X{X-B3-SpanId:-},%X{X-Span-Export:-}] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger:%line - %msg%n</pattern>
		</encoder>
	</appender>

	<!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->

	<appender name="WARN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/warn.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>debug.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>1000KB</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>30</maxHistory>
		</rollingPolicy>
	</appender>
	
	<appender name="RECOMMEND_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Data/logs/ufo-gateway/recommend.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->
            <fileNamePattern>
                /Data/logs/ufo-gateway/archived/recommend.%d{yyyy-MM-dd}.%i.log.gz
            </fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <!-- or whenever the file size reaches 100MB -->
                <maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <!-- keep 30 days' worth of history -->
            <maxHistory>${yoho.logs.maxHistory}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
        </encoder>
    </appender>

	<appender name="LOGIN_LOW_CLIENT_TYPE_RECORD" class="ch.qos.logback.core.rolling.RollingFileAppender">
	<file>/Data/logs/ufo-gateway/login_low_clientType_record.log</file>
	<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
		<!-- daily rollover -->
		<fileNamePattern>/Data/logs/ufo-gateway/archived/login_low_clientType_record.%d{yyyy-MM-dd}.%i.log.gz
		</fileNamePattern>
		<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
			<!-- or whenever the file size reaches 100MB -->
			<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
		</timeBasedFileNamingAndTriggeringPolicy>
		<!-- keep 30 days' worth of history -->
		<maxHistory>${yoho.logs.maxHistory}</maxHistory>
	</rollingPolicy>

	<encoder>
		<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
	</encoder>
</appender>


	<appender name="GRAPH_VERIFY_SWITCH" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/graph_verify_switch.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/graph_verify_switch.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>

		<encoder>
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>

	<appender name="LOGIN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/login.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>
				/Data/logs/ufo-gateway/archived/login.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
		</encoder>
	</appender>

	<appender name="SESSION_LOGIN_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/session-login.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>
				/Data/logs/ufo-gateway/archived/session-login.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
		</encoder>
	</appender>

	<!-- DEBUG级别日志 appender -->
	<appender name="ORDER_CLOSE" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/order-close.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- daily rollover -->
			<fileNamePattern>
				/Data/logs/ufo-gateway/archived/order-close.%d{yyyy-MM-dd}.%i.log.gz
			</fileNamePattern>
			<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
				<!-- or whenever the file size reaches 100MB -->
				<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
			</timeBasedFileNamingAndTriggeringPolicy>
			<!-- keep 30 days' worth of history -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<encoder>
			<pattern>%-1relative - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{0}:%line -- %msg%n</pattern>
		</encoder>
	</appender>

	<appender name="MQ_CONSUMER" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/mq-consumer.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- 按天回滚 daily -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/mq-consumer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
			<!-- 日志最大的历史 60天 -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
			<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
		</triggeringPolicy>
		<encoder>
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>

	<appender name="MQ_PRODUCER" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/mq-producer.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- 按天回滚 daily -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/mq-producer.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
			<!-- 日志最大的历史 60天 -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
			<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
		</triggeringPolicy>
		<encoder>
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>


	<appender name="SELLER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/seller-order.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- 按天回滚 daily -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/seller-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
			<!-- 日志最大的历史 60天 -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
			<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
		</triggeringPolicy>
		<encoder>
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>


	<appender name="BUYER_ORDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
		<file>/Data/logs/ufo-gateway/buyer-order.log</file>
		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
			<!-- 按天回滚 daily -->
			<fileNamePattern>/Data/logs/ufo-gateway/archived/buyer-order.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
			<!-- 日志最大的历史 60天 -->
			<maxHistory>${yoho.logs.maxHistory}</maxHistory>
		</rollingPolicy>
		<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
			<maxFileSize>${yoho.logs.maxFileSize}</maxFileSize>
		</triggeringPolicy>
		<encoder>
			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>
		</encoder>
	</appender>

	<logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
	<!-- 登录时,如果一个IP在一定时间内登录次数过多,记录日志 appender -->
	<logger name="ipLoginMoreLog" level="INFO" additivity="false">
		<appender-ref ref="IP_LOGIN_MORE_LOG" />
	</logger>
	<logger name="org.apache.zookeeper.ClientCnxn" level="WARN" />
	<logger name="com.yoho.core.rest.client.finder.zookeeper.CuratorXDiscoveryClientWrapper" level="INFO" />

	<!-- resources -->
	<logger name="TRACE" additivity="true">
		<level value="TRACE"/>
		<appender-ref ref="STDOUT"/>
	</logger>
	<root level="INFO">
		<appender-ref ref="STDOUT" />
		<appender-ref ref="WARN_LOG" />
	</root>
	<!-- 推荐位 大数据采集 -->
    <logger name="recommendLogger" additivity="true">
        <level value="INFO"/>
        <appender-ref ref="RECOMMEND_LOG"/>
    </logger>


	<!-- 3.8.1 之前的版本记录日志-->
	<logger name="loginLowClientRecord" additivity="true">
		<level value="INFO"/>
		<appender-ref ref="LOGIN_LOW_CLIENT_TYPE_RECORD"/>
	</logger>

	<logger name="graphVerify_switch" additivity="true">
		<level value="INFO"/>
		<appender-ref ref="GRAPH_VERIFY_SWITCH"/>
	</logger>

	<!-- 用户登录日志 -->
	<logger name="loginLog" additivity="true">
		<level value="INFO"/>
		<appender-ref ref="LOGIN_LOG"/>
	</logger>

	<!-- 用户session登录日志 -->
	<logger name="sessionLoginLog" additivity="false">
		<level value="INFO"/>
		<appender-ref ref="SESSION_LOGIN_LOG"/>
	</logger>


	<logger name="com.ufo.gateway.controller.product.ProductCacheFinder" additivity="true">
		<level value="DEBUG"/>
		<appender-ref ref="DEBUG_LOG"/>
	</logger>

	<!-- 订单取消日志 -->
	<logger name="orderCloseLog" level="INFO" additivity="false">
		<appender-ref ref="ORDER_CLOSE" />
	</logger>

	<!-- MQ消费日志 -->
	<logger name="mqConsumerLog" level="INFO" additivity="false">
		<appender-ref ref="MQ_CONSUMER" />
	</logger>

	<!-- MQ生产日志 -->
	<logger name="mqProducerLog" level="INFO" additivity="false">
		<appender-ref ref="MQ_PRODUCER" />
	</logger>


	<logger name="sellerOrderLog" level="INFO" additivity="false">
		<appender-ref ref="SELLER_ORDER" />
	</logger>

	<logger name="buyerOrderLog" level="INFO" additivity="false">
		<appender-ref ref="BUYER_ORDER" />
	</logger>
</configuration>