logback.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <!--
  2. Copyright 2022 The Apache Software Foundation
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  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. Define some default values that can be overridden by system properties
  17. -->
  18. <configuration>
  19. <!-- Uncomment this if you would like to expose Logback JMX beans -->
  20. <!--jmxConfigurator /-->
  21. <property name="zookeeper.console.threshold" value="INFO" />
  22. <property name="zookeeper.log.dir" value="." />
  23. <property name="zookeeper.log.file" value="zookeeper.log" />
  24. <property name="zookeeper.log.threshold" value="INFO" />
  25. <property name="zookeeper.log.maxfilesize" value="256MB" />
  26. <property name="zookeeper.log.maxbackupindex" value="20" />
  27. <!--
  28. console
  29. Add "console" to root logger if you want to use this
  30. -->
  31. <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
  32. <encoder>
  33. <pattern>%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n</pattern>
  34. </encoder>
  35. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  36. <level>${zookeeper.console.threshold}</level>
  37. </filter>
  38. </appender>
  39. <!--
  40. Add ROLLINGFILE to root logger to get log file output
  41. -->
  42. <!--appender name="ROLLINGFILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
  43. <File>${zookeeper.log.dir}/${zookeeper.log.file}</File>
  44. <encoder>
  45. <pattern>%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n</pattern>
  46. </encoder>
  47. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  48. <level>${zookeeper.log.threshold}</level>
  49. </filter>
  50. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  51. <maxIndex>${zookeeper.log.maxbackupindex}</maxIndex>
  52. <FileNamePattern>${zookeeper.log.dir}/${zookeeper.log.file}.%i</FileNamePattern>
  53. </rollingPolicy>
  54. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  55. <MaxFileSize>${zookeeper.log.maxfilesize}</MaxFileSize>
  56. </triggeringPolicy>
  57. </appender-->
  58. <!--
  59. Add TRACEFILE to root logger to get log file output
  60. Log TRACE level and above messages to a log file
  61. -->
  62. <!--property name="zookeeper.tracelog.dir" value="${zookeeper.log.dir}" />
  63. <property name="zookeeper.tracelog.file" value="zookeeper_trace.log" />
  64. <appender name="TRACEFILE" class="ch.qos.logback.core.FileAppender">
  65. <File>${zookeeper.tracelog.dir}/${zookeeper.tracelog.file}</File>
  66. <encoder>
  67. <pattern>%d{ISO8601} [myid:%X{myid}] - %-5p [%t:%C{1}@%L] - %m%n</pattern>
  68. </encoder>
  69. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  70. <level>TRACE</level>
  71. </filter>
  72. </appender-->
  73. <!--
  74. zk audit logging
  75. -->
  76. <!--property name="zookeeper.auditlog.file" value="zookeeper_audit.log" />
  77. <property name="zookeeper.auditlog.threshold" value="INFO" />
  78. <property name="audit.logger" value="INFO, RFAAUDIT" />
  79. <appender name="RFAAUDIT" class="ch.qos.logback.core.rolling.RollingFileAppender">
  80. <File>${zookeeper.log.dir}/${zookeeper.auditlog.file}</File>
  81. <encoder>
  82. <pattern>%d{ISO8601} %p %c{2}: %m%n</pattern>
  83. </encoder>
  84. <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
  85. <level>${zookeeper.auditlog.threshold}</level>
  86. </filter>
  87. <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
  88. <maxIndex>10</maxIndex>
  89. <FileNamePattern>${zookeeper.log.dir}/${zookeeper.auditlog.file}.%i</FileNamePattern>
  90. </rollingPolicy>
  91. <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
  92. <MaxFileSize>10MB</MaxFileSize>
  93. </triggeringPolicy>
  94. </appender>
  95. <logger name="org.apache.zookeeper.audit.Slf4jAuditLogger" additivity="false" level="${audit.logger}">
  96. <appender-ref ref="RFAAUDIT" />
  97. </logger-->
  98. <root level="INFO">
  99. <appender-ref ref="CONSOLE" />
  100. </root>
  101. </configuration>