소스 검색

日志管理

zouxuan 1 년 전
부모
커밋
6ab44e242f
1개의 변경된 파일17개의 추가작업 그리고 5개의 파일을 삭제
  1. 17 5
      cooleshow-app/src/main/resources/logback-spring.xml

+ 17 - 5
cooleshow-app/src/main/resources/logback-spring.xml

@@ -10,6 +10,21 @@
 			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
 		</encoder>
 	</appender>
+	<appender name="mysql_log" class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<file>${LOG_HOME}</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<!-- 日志文件输出文件名 -->
+			<FileNamePattern>${LOG_HOME}</FileNamePattern>
+			<!-- 日志文件保留天数 -->
+			<MaxHistory>7</MaxHistory>
+		</rollingPolicy>
+		<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>DEBUG</level>
+		</filter>
+	</appender>
 
 	<appender name="file"
 		class="ch.qos.logback.core.rolling.RollingFileAppender">
@@ -26,9 +41,6 @@
 			<pattern>${CONSOLE_LOG_PATTERN}</pattern>
 		</encoder>
 	</appender>
-	<Logger name="com.baomidou.mybatisplus" level="TRACE" additivity="false">
-		<appender-ref ref="file" level="TRACE" />
-	</Logger>
 	<appender name="plumelog" class="com.plumelog.logback.appender.RedisAppender">
 		<appName>cooleshow-app</appName>
 		<redisHost>10.206.0.13:26379,10.206.0.16:26379,10.206.0.8:26379</redisHost>
@@ -39,7 +51,7 @@
 		<redisDb>10</redisDb>
 		<runModel>2</runModel>
 	</appender>
-	<logger name="com.yonge" level="DEBUG" />
+	<logger name="com.yonge" level="INFO" />
 
 	<!--本地环境:打印控制台 -->
 	<springProfile name="local">
@@ -64,7 +76,7 @@
 	</springProfile>
 
 	<springProfile name="pre">
-		<root level="DEBUG">
+		<root level="INFO">
 			<appender-ref ref="stdout" />
 			<appender-ref ref="file" />
 			<appender-ref ref="plumelog" />