Browse Source

任务来源:机场

任务描述:修改logback
develop
wubin 1 year ago
parent
commit
2f07e0b2d9
1 changed files with 54 additions and 14 deletions
  1. +54
    -14
      tuoheng-admin/src/main/resources/logback.xml

+ 54
- 14
tuoheng-admin/src/main/resources/logback.xml View File

@@ -1,32 +1,72 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true -->
<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。
当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!--
contextName说明:
每个logger都关联到logger上下文,默认上下文名称为“default”。但可以使用设置成其他名字,
用于区分不同应用程序的记录。一旦设置,不能修改,可以通过%contextName来打印日志上下文名称。
-->
<contextName>tuoheng-dsp-flowable</contextName>

<!--定义日志变量-->
<property name="logging.path" value="/data/java/logs/tuoheng_airport_platform"/>
<!--日志格式: [时间] [级别] [线程] [行号] [logger信息] - [日志信息]-->
<property name="logging.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%level][%thread][%L] %logger - %msg%n"/>
<property name="logging.charset" value="UTF-8"/>
<property name="logging.maxHistory" value="15"/>
<property name="logging.totalSizeCap" value="5GB"/>
<property name="logging.maxFileSize" value="40MB"/>

<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<pattern>${logging.pattern}</pattern>
<charset>${logging.charset}</charset>
</encoder>
</appender>

<appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/data/java/logs/tuoheng_airport_platform/tuoheng_airport.log</file>
<!-- <file>/Users/zhuzs/Documents/file/logs/tuoheng_5gai.log</file>-->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- <fileNamePattern>/Users/zhuzs/Documents/file/logs/tuoheng_5gai.log.%d{yyyy-MM-dd}.log</fileNamePattern>-->
<fileNamePattern>/data/java/logs/tuoheng_airport_platform/tuoheng_airport.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>30</maxHistory>
<appender name="LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${logging.path}/admin/tuoheng_airport_admin.log</File>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${logging.path}/admin/tuoheng_airport_admin-%d-%i.log</fileNamePattern>
<!-- 最大保存天数-->
<maxHistory>${logging.maxHistory}</maxHistory>
<totalSizeCap>${logging.totalSizeCap}</totalSizeCap>
<maxFileSize>${logging.maxFileSize}</maxFileSize>
</rollingPolicy>
<!--编码器-->
<encoder>
<pattern>%date{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<pattern>${logging.pattern}</pattern>
<charset>${logging.charset}</charset>
</encoder>
</appender>

<!-- project default level -->
<logger name="com.tuoheng" level="DEBUG" />
<appender name="file.async" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>512</queueSize>
<includeCallerData>true</includeCallerData>
<appender-ref ref="LOG_FILE" />
</appender>

<logger name="com.tuoheng" level="DEBUG" additivity="false">
<appender-ref ref="console" />
<appender-ref ref="file.async" />
</logger>

<!--log4jdbc -->
<logger name="jdbc.sqltiming" level="DEBUG"/>
<logger name="jdbc.sqlonly" level="DEBUG" additivity="false">
<appender-ref ref="file.async" />
</logger>
<logger name="jdbc.sqltiming" level="DEBUG" additivity="false">
<appender-ref ref="file.async" />
</logger>

<root level="INFO">
<appender-ref ref="console" />
<appender-ref ref="rollingFile" />
<appender-ref ref="file.async" />
</root>
</configuration>

Loading…
Cancel
Save