| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| --> |
| |
| <configuration> |
| |
| <appender name="system" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| <file>${user.home}/logs/simple/system.log</file> |
| <append>true</append> |
| <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> |
| <fileNamePattern>${user.home}/logs/simple/system.%i.log |
| </fileNamePattern> |
| <minIndex>1</minIndex> |
| <maxIndex>30</maxIndex> |
| </rollingPolicy> |
| <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> |
| <maxFileSize>100MB</maxFileSize> |
| </triggeringPolicy> |
| <encoder> |
| <pattern>%date %p %t - %m%n</pattern> |
| <charset class="java.nio.charset.Charset">UTF-8</charset> |
| </encoder> |
| </appender> |
| |
| <appender name="consoleAppender" class="ch.qos.logback.core.ConsoleAppender"> |
| <target>System.out</target> |
| <encoder> |
| <pattern>%date %p %t - %m%n</pattern> |
| <charset class="java.nio.charset.Charset">UTF-8</charset> |
| </encoder> |
| </appender> |
| |
| <appender name="dailyAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| <file>${user.home}/logs/simple/daily.log</file> |
| <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
| <fileNamePattern>${user.home}/logs/simple/daily.log.%d{yyyy-MM-dd_HH}</fileNamePattern> |
| <maxHistory>30</maxHistory> |
| </rollingPolicy> |
| <encoder> |
| <pattern>%date %p %t - %m%n</pattern> |
| </encoder> |
| </appender> |
| |
| <appender name="mqAppender1" class="org.apache.rocketmq.logappender.logback.RocketmqLogbackAppender"> |
| <tag>log1</tag> |
| <topic>TopicTest</topic> |
| <producerGroup>logback</producerGroup> |
| <nameServerAddress>127.0.0.1:9876</nameServerAddress> |
| <layout> |
| <pattern>%date %p %t - %m%n</pattern> |
| </layout> |
| </appender> |
| |
| <appender name="mqAsyncAppender1" class="ch.qos.logback.classic.AsyncAppender"> |
| <queueSize>1024</queueSize> |
| <discardingThreshold>80</discardingThreshold> |
| <maxFlushTime>2000</maxFlushTime> |
| <neverBlock>true</neverBlock> |
| <appender-ref ref="mqAppender1"/> |
| </appender> |
| |
| <root> |
| <level value="debug"/> |
| <appender-ref ref="consoleAppender"/> |
| </root> |
| |
| <logger name="systemLogger" level="debug" additivity="false"> |
| <appender-ref ref="system"/> |
| </logger> |
| |
| <logger name="testLogger" level="debug" additivity="false"> |
| <appender-ref ref="mqAsyncAppender1"/> |
| <appender-ref ref="consoleAppender"/> |
| </logger> |
| </configuration> |