• 日志配置备忘


    logback

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    	<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    		<encoder charset="UTF-8">
    			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80}[%L] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<appender name="SYS_INFO"
    		class="ch.qos.logback.core.rolling.RollingFileAppender">
    		<file>${location}/sys-info.log</file>
    		<append>true</append>
    		<filter class="ch.qos.logback.classic.filter.LevelFilter">
    			<level>INFO</level>
    			<onMatch>ACCEPT</onMatch>
    			<onMismatch>DENY</onMismatch>
    		</filter>
    		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    			<fileNamePattern>${location}/sys-info.%d{yyyy-MM-dd}.%i.log
    			</fileNamePattern>
    			<timeBasedFileNamingAndTriggeringPolicy
    				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    				<maxFileSize>100MB</maxFileSize>
    			</timeBasedFileNamingAndTriggeringPolicy>
    			<maxHistory>100</maxHistory>
    		</rollingPolicy>
    
    		<encoder charset="UTF-8">
    			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80}[%L] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<appender name="SYS_ERROR"
    		class="ch.qos.logback.core.rolling.RollingFileAppender">
    		<file>${location}/sys-error.log</file>
    		<append>true</append>
    		<filter class="ch.qos.logback.classic.filter.LevelFilter">
    			<level>ERROR</level>
    			<onMatch>ACCEPT</onMatch>
    			<onMismatch>DENY</onMismatch>
    		</filter>
    		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    			<fileNamePattern>${location}/sys-error.%d{yyyy-MM-dd}.%i.log
    			</fileNamePattern>
    			<timeBasedFileNamingAndTriggeringPolicy
    				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    				<maxFileSize>100MB</maxFileSize>
    			</timeBasedFileNamingAndTriggeringPolicy>
    			<maxHistory>100</maxHistory>
    		</rollingPolicy>
    
    		<encoder charset="UTF-8">
    			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80}[%L] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<appender name="app-info"
    		class="ch.qos.logback.core.rolling.RollingFileAppender">
    		<file>${location}/app-info.log</file>
    		<append>true</append>
    		<filter class="ch.qos.logback.classic.filter.LevelFilter">
    			<level>INFO</level>
    			<onMatch>ACCEPT</onMatch>
    			<onMismatch>DENY</onMismatch>
    		</filter>
    		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    			<fileNamePattern>${location}/app-info.%d{yyyy-MM-dd}.%i.log
    			</fileNamePattern>
    			<timeBasedFileNamingAndTriggeringPolicy
    				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    				<maxFileSize>100MB</maxFileSize>
    			</timeBasedFileNamingAndTriggeringPolicy>
    			<maxHistory>100</maxHistory>
    		</rollingPolicy>
    
    		<encoder charset="UTF-8">
    			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80}[%L] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<appender name="app-error"
    		class="ch.qos.logback.core.rolling.RollingFileAppender">
    		<file>${location}/app-error.log</file>
    		<append>true</append>
    		<filter class="ch.qos.logback.classic.filter.LevelFilter">
    			<level>ERROR</level>
    			<onMatch>ACCEPT</onMatch>
    			<onMismatch>DENY</onMismatch>
    		</filter>
    		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    			<fileNamePattern>${location}/app-error.%d{yyyy-MM-dd}.%i.log
    			</fileNamePattern>
    			<timeBasedFileNamingAndTriggeringPolicy
    				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    				<maxFileSize>100MB</maxFileSize>
    			</timeBasedFileNamingAndTriggeringPolicy>
    			<maxHistory>100</maxHistory>
    		</rollingPolicy>
    
    		<encoder charset="UTF-8">
    			<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{80}[%L] - %msg%n</pattern>
    		</encoder>
    	</appender>
    
    	<logger name="com.jd" level="INFO" additivity="false">
    		<appender-ref ref="CONSOLE" />
    		<appender-ref ref="app-info" />
    		<appender-ref ref="app-error" />
    	</logger>
    
    
    	<root level="INFO">
    		<appender-ref ref="CONSOLE" />
    		<appender-ref ref="SYS_INFO" />
    		<appender-ref ref="SYS_ERROR" />
    	</root>
    </configuration>

    log4j

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
    
    <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
    
    	<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
    		</layout>
    
    		<!--限制输出级别 -->
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="${bjxizhan.log4j.logger.level}" />
    		</filter>
    	</appender>
    
    	<appender name="FILE-ALL" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/web-all.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="${bjxizhan.log4j.logger.level}" />
    		</filter>
    	</appender>
    
    	<appender name="FILE-ERROR" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/web-error.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="ERROR" />
    		</filter>
    	</appender>
    
    	<!-- 页面VM日志 -->
    	<appender name="FILE-VELOCITY" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/web-velocity.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="WARN" />
    		</filter>
    	</appender>
    
    	<!-- 投资人账户数据流变化日志 -->
    	<appender name="FLOW-DATA" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/flow-data.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="INFO" />
    		</filter>
    	</appender>
    
    	<!-- 投资人提现请求接口日志 -->
    	<appender name="WITHDRAW-DATA" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/withdraw-data.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="INFO" />
    		</filter>
    	</appender>
    
    	<!-- 投资人充值回调日志 -->
    	<appender name="RECHARGE-DATA" class="org.apache.log4j.DailyRollingFileAppender">
    		<param name="File" value="${bjxizhan.log4j.logger.path}/lender-web/recharge-data.log" />
    		<param name="Append" value="true" />
    		<param name="Encoding" value="UTF-8" />
    		<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern" value="%d - %m%n" />
    		</layout>
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="INFO" />
    		</filter>
    	</appender>
    
    	<!-- 下面是打印mybatis语句的配置-->
    	<appender name="IBatis" class="org.apache.log4j.ConsoleAppender">
    		<layout class="org.apache.log4j.PatternLayout">
    			<param name="ConversionPattern"
    				   value="%d - %c -%-4r [%t] %-5p %x - %m%n" />
    		</layout>
    
    		<filter class="org.apache.log4j.varia.LevelRangeFilter">
    			<param name="LevelMin" value="DEBUG"/>
    		</filter>
    	</appender>
    
    	<category name="org.apache.ibatis" additivity="true">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="FILE-ERROR"/>
    		<appender-ref ref="FILE-ALL" />
    	</category>
    
    	<category name="org.apache.velocity" additivity="false">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="FILE-VELOCITY" />
    		<appender-ref ref="FILE-ALL" />
    	</category>
    
    	<category name="com.bjxizhan.lender" additivity="true">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="FILE-VELOCITY" />
    		<appender-ref ref="FILE-ERROR"/>
    		<appender-ref ref="FILE-ALL" />
    	</category>
    
    	<category name="flow-data-logger" additivity="false">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="FLOW-DATA" />
    	</category>
    
    	<category name="withdraw-data-logger" additivity="false">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="WITHDRAW-DATA" />
    	</category>
    
    	<category name="recharge-data-logger" additivity="false">
    		<level value="${bjxizhan.log4j.logger.level}" />
    		<appender-ref ref="RECHARGE-DATA" />
    	</category>
    
    	<root>
    		<level value="${bjxizhan.log4j.logger.level}"/>
    		<appender-ref ref="CONSOLE"/>
    	</root>
    
    
    </log4j:configuration>
    <!--
    	<logger name="com.ibatis" additivity="true">
    		<level value="DEBUG" />
    	</logger>
    	<logger name="java.sql.Connection" additivity="true">
    		<level value="DEBUG" />
    	</logger>
    	<logger name="java.sql.Statement" additivity="true">
    		<level value="DEBUG" />
    	</logger>
    	<logger name="java.sql.PreparedStatement" additivity="true">
    		<level value="DEBUG" />
    		<appender-ref ref="IBatis" />
    	</logger>
    	<logger name="java.sql.ResultSet" additivity="true">
    		<level value="DEBUG" />
    		<appender-ref ref="IBatis" />
    	</logger>
    	-->
    京东技术
  • 相关阅读:
    Neo4j自定义主键策略
    spring cloud Alibaba nacos 整合Neo4j pom 配置
    spring cloud Alibaba nacos 整合Neo4j配置
    若依前端 devtool source-map设置
    基于draw.io的二次开发,文件增加本地以及oss存储
    十多年来从三个容器管理系统中吸取的教训
    java8 CompletableFuture,allOf多实例返回
    CompletableFuture 使用详解
    使用CompletableFuture实现业务服务的异步调用
    [转]uni-app开发踩坑之路之this指向问题
  • 原文地址:https://www.cnblogs.com/wely/p/6198737.html
Copyright © 2020-2023  润新知