From 6837fb8dc0d4d7c69d556ad99bc5139ed0bd9c7c Mon Sep 17 00:00:00 2001 From: liu <liujiatong112@163.com> Date: Mon, 20 Nov 2023 15:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/virtual-patient-web/src/main/resources/logback-spring.xml b/virtual-patient-web/src/main/resources/logback-spring.xml index ff6e1417..4bf446b2 100644 --- a/virtual-patient-web/src/main/resources/logback-spring.xml +++ b/virtual-patient-web/src/main/resources/logback-spring.xml @@ -4,19 +4,50 @@ <logger name="org.springframework.web" level="INFO"/> <logger name="org.springboot.sample" level="TRACE"/> - <!-- 开发、测试环境 --> + <property name="logPath" value="/data/vp/log/" /> + + <appender name="DAILY_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <!-- 服务器中当天的日志 --> + <file>${logPath}/virtual-patient.log</file> + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> + <!-- 服务器归档日志 --> + <fileNamePattern>${logPath}/history/virtual-patient-%d{yyyy-MM-dd}.log</fileNamePattern> + </rollingPolicy> + <encoder> + <pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern> + </encoder> + </appender> + + <!-- 开发环境 --> + <springProfile name="dev,local"> + <logger name="org.springframework.web" level="DEBUG"/> + <logger name="org.springboot.sample" level="DEBUG"/> + <logger name="com.supervision" level="DEBUG"/> + <logger name="org.springframework.scheduling" level="DEBUG"/> + </springProfile> + + <!-- 测试环境 --> <springProfile name="dev,test,local"> <logger name="org.springframework.web" level="DEBUG"/> <logger name="org.springboot.sample" level="DEBUG"/> <logger name="com.supervision" level="DEBUG"/> <logger name="org.springframework.scheduling" level="DEBUG"/> + <root level="DEBUG"> + <appender-ref ref="DAILY_LOG" /> + </root> </springProfile> + <!-- 生产环境 --> <springProfile name="prod"> <logger name="org.springframework.web" level="ERROR"/> <logger name="org.springboot.sample" level="ERROR"/> <logger name="com.supervision" level="INFO"/> + <logger name="org.springframework.scheduling" level="DEBUG"/> + <root level="info"> + <appender-ref ref="DAILY_LOG" /> + </root> </springProfile> + </configuration> \ No newline at end of file