越南富佳项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

167 lines
7.2 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!--配置说明:
https://www.cnblogs.com/jybky/p/12204586.html
https://blog.csdn.net/wzygis/article/details/103189490
https://www.cnblogs.com/xrq730/p/8628945.html
https://www.jianshu.com/p/af5a7bab0e59
https://blog.csdn.net/wzygis/article/details/103189490
https://juejin.cn/post/6844903775631572999
-->
<configuration scan="true" scanPeriod="30 seconds" debug="false">
<contextName>nlAdmin</contextName>
<property name="log.charset" value="utf-8"/>
<property name="log.pattern"
value="%cyan(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %cyan(%msg%n)"/>
<springProperty scope="context" name="logPath" source="logging.file.path" defaultValue="logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<!--引入默认的一些设置-->
<include resource="log/XgAgvDeviceDriver.xml"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<!--withJansi 参数改为true-->
<withJansi>true</withJansi>
<encoder class="com.yomahub.tlog.core.enhance.logback.AspectLogbackEncoder">
<pattern>${log.pattern}</pattern>
<!-- <charset>${log.charset}</charset>-->
</encoder>
</appender>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
<property name="LOG_HOME" value="${logPath}"/>
<!-- 按照每天生成日志文件 -->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名-->
<FileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log</FileNamePattern>
<!--日志文件保留天数-->
<maxHistory>15</maxHistory>
<!--单个日志最大容量 至少10MB才能看得出来-->
<maxFileSize>50MB</maxFileSize>
<!--所有日志最多占多大容量-->
<totalSizeCap>20GB</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符-->
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
</encoder>
</appender>
<!--异步到文件-->
<appender name="asyncFileAppender" class="com.yomahub.tlog.core.enhance.logback.async.AspectLogbackAsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>500</queueSize>
<appender-ref ref="FILE"/>
</appender>
<!--开发环境:打印控制台-->
<springProfile name="dev">
<root level="info">
<appender-ref ref="asyncFileAppender"/>
<appender-ref ref="CONSOLE"/>
</root>
<logger name="org.springframework" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.apache" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.hibernate" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="io.netty" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="jdbc" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="io.lettuce" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="com.fasterxml" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.quartz" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="com.google" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="springfox" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="log4jdbc" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="nl.basjes" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
</springProfile>
<!--生产环境:打印控制台和输出到文件-->
<springProfile name="prod">
<root level="debug">
<appender-ref ref="asyncFileAppender"/>
</root>
<logger name="org.springframework" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.apache" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.hibernate" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="io.netty" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="jdbc" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="io.lettuce" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="com.fasterxml" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="org.quartz" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="com.google" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="springfox" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="log4jdbc" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
<logger name="nl.basjes" level="ERROR" additivity="false">
<appender-ref ref="asyncFileAppender"/>
</logger>
</springProfile>
<!--测试环境:打印控制台-->
<springProfile name="test">
<root level="info">
<appender-ref ref="asyncFileAppender"/>
</root>
<logger name="jdbc.audit" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="jdbc.resultset" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="springfox.documentation" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="jdbc.resultsettable" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
<logger name="jdbc.sqlonly" level="ERROR" additivity="false">
<appender-ref ref="CONSOLE"/>
</logger>
</springProfile>
</configuration>