file-appender.xml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright 1999-2019 Seata.io Group.
  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. <included>
  18. <!-- file-appender properties -->
  19. <springProperty name="LOG_FILE_PATH" source="logging.file.path"
  20. defaultValue="${user.home}/logs/seata"/>
  21. <springProperty name="FILE_LOG_PATTERN" source="logging.pattern.file"
  22. defaultValue="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p --- [%30.30t] %-40.40logger{39} : %m%n%wEx2"/>
  23. <!--ALL-->
  24. <appender name="FILE_ALL" class="ch.qos.logback.core.rolling.RollingFileAppender">
  25. <file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.all.log</file>
  26. <append>true</append>
  27. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  28. <fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.all.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  29. <maxFileSize>2GB</maxFileSize>
  30. <MaxHistory>7</MaxHistory>
  31. <totalSizeCap>7GB</totalSizeCap>
  32. <cleanHistoryOnStart>true</cleanHistoryOnStart>
  33. </rollingPolicy>
  34. <encoder>
  35. <Pattern>${FILE_LOG_PATTERN}</Pattern>
  36. <charset>UTF-8</charset>
  37. </encoder>
  38. </appender>
  39. <!--WARN-->
  40. <appender name="FILE_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
  41. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  42. <level>WARN</level>
  43. <onMatch>ACCEPT</onMatch>
  44. <onMismatch>DENY</onMismatch>
  45. </filter>
  46. <file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.warn.log</file>
  47. <append>true</append>
  48. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  49. <fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.warn.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  50. <maxFileSize>2GB</maxFileSize>
  51. <MaxHistory>7</MaxHistory>
  52. <totalSizeCap>7GB</totalSizeCap>
  53. <cleanHistoryOnStart>true</cleanHistoryOnStart>
  54. </rollingPolicy>
  55. <encoder>
  56. <Pattern>${FILE_LOG_PATTERN}</Pattern>
  57. <charset>UTF-8</charset>
  58. </encoder>
  59. </appender>
  60. <!--ERROR-->
  61. <appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
  62. <filter class="ch.qos.logback.classic.filter.LevelFilter">
  63. <level>ERROR</level>
  64. <onMatch>ACCEPT</onMatch>
  65. <onMismatch>DENY</onMismatch>
  66. </filter>
  67. <file>${LOG_FILE_PATH}/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.error.log</file>
  68. <append>true</append>
  69. <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
  70. <fileNamePattern>${LOG_FILE_PATH}/history/${APPLICATION_NAME:-seata-server}.${RPC_PORT}.error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
  71. <maxFileSize>2GB</maxFileSize>
  72. <MaxHistory>7</MaxHistory>
  73. <totalSizeCap>7GB</totalSizeCap>
  74. <cleanHistoryOnStart>true</cleanHistoryOnStart>
  75. </rollingPolicy>
  76. <encoder>
  77. <Pattern>${FILE_LOG_PATTERN}</Pattern>
  78. <charset>UTF-8</charset>
  79. </encoder>
  80. </appender>
  81. </included>