基于pigx的分布式架构
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.

72 lines
3.2 KiB

11 months ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright (c) 2020 pig4cloud Authors. All Rights Reserved.
  4. ~
  5. ~ Licensed under the Apache License, Version 2.0 (the "License");
  6. ~ you may not use this file except in compliance with the License.
  7. ~ You may obtain a copy of the License at
  8. ~
  9. ~ http://www.apache.org/licenses/LICENSE-2.0
  10. ~
  11. ~ Unless required by applicable law or agreed to in writing, software
  12. ~ distributed under the License is distributed on an "AS IS" BASIS,
  13. ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ~ See the License for the specific language governing permissions and
  15. ~ limitations under the License.
  16. -->
  17. <configuration debug="false" scan="false">
  18. <springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
  19. <property name="log.path" value="logs/${spring.application.name}"/>
  20. <!-- 彩色日志格式 -->
  21. <property name="CONSOLE_LOG_PATTERN"
  22. value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
  23. <!-- 彩色日志依赖的渲染类 -->
  24. <conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
  25. <conversionRule conversionWord="wex"
  26. converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
  27. <conversionRule conversionWord="wEx"
  28. converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
  29. <!-- Console log output -->
  30. <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
  31. <encoder>
  32. <pattern>${CONSOLE_LOG_PATTERN}</pattern>
  33. </encoder>
  34. </appender>
  35. <!-- Log file debug output -->
  36. <appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
  37. <file>${log.path}/debug.log</file>
  38. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  39. <fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  40. <maxFileSize>50MB</maxFileSize>
  41. <maxHistory>30</maxHistory>
  42. </rollingPolicy>
  43. <encoder>
  44. <pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
  45. </encoder>
  46. </appender>
  47. <!-- Log file error output -->
  48. <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
  49. <file>${log.path}/error.log</file>
  50. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  51. <fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  52. <maxFileSize>50MB</maxFileSize>
  53. <maxHistory>30</maxHistory>
  54. </rollingPolicy>
  55. <encoder>
  56. <pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
  57. </encoder>
  58. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  59. <level>ERROR</level>
  60. </filter>
  61. </appender>
  62. <!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
  63. <root level="INFO">
  64. <appender-ref ref="console"/>
  65. <appender-ref ref="debug"/>
  66. <appender-ref ref="error"/>
  67. </root>
  68. </configuration>