<?xml version="1.0" encoding="UTF-8"?>
<configuration status="error">
<!--先定义所有的appender-->
<appenders>
<!--这个输出控制台的配置-->
<Console name="Console" target="SYSTEM_OUT">
<!--这个都知道是输出日志的格式-->
<PatternLayout pattern="%d{HH:mm:ss} %-5level %class{36} %L %M --------------%msg%n%xEx%n"/>
</Console>
<!--文件会打印出所有信息,这个log每次运行程序会自动清空,由append属性决定,这个也挺有用的,适合临时测试用-->
<File name="debug" fileName="./logs/HitoIOTPlatform-debug.log" append="false">
<Filters>
<ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="%d{MM-dd HH:mm:ss} %-5level %class{36} %L %M --------------%msg%xEx%n"/>
</File>
<File name="info" fileName="./logs/HitoIOTPlatform-info.log" append="false">
<Filters>
<ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="%d{MM-dd HH:mm:ss} %-5level %class{36} %L %M --------------%msg%xEx%n"/>
</File>
<File name="warn" fileName="./logs/HitoIOTPlatform-warn.log" append="false">
<Filters>
<ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="%d{MM-dd HH:mm:ss} %-5level %class{36} %L %M --------------%msg%xEx%n"/>
</File>
<File name="error" fileName="./logs/HitoIOTPlatform-error.log" append="false">
<Filters>
<ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/>
<ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
</Filters>
<PatternLayout pattern="%d{MM-dd HH:mm:ss} %-5level %class{36} %L %M --------------%msg%xEx%n"/>
</File>
<!--这个会打印出所有的信息,每次大小超过size,则这size大小的日志会自动存入按年份-月份建立的文件夹下面并进行压缩,作为存档-->
<RollingFile name="RollingFile" fileName="./logs/HitoIOTPlatform-all.log"
filePattern="logs/$${date:yyyy-MM}/app-%d{MM-dd-yyyy}-%i.log.gz">
<PatternLayout pattern="%d{yyyy-MM-dd 'at' HH:mm:ss z} %-5level %class{36} %L %M --------------%msg%xEx%n"/>
<SizeBasedTriggeringPolicy size="100MB"/>
</RollingFile>
</appenders>
<!--然后定义logger,只有定义了logger并引入的appender,appender才会生效-->
<loggers>
<!--建立一个默认的root的logger-->
<Logger name="HitoIOTPlatform" additivity="false" >
<AppenderRef ref="debug" />
<AppenderRef ref="info" />
<AppenderRef ref="warn" />
<AppenderRef ref="error"/>
<AppenderRef ref="Console" level="trace"/>
<AppenderRef ref="RollingFile" level="trace" />
</Logger>
<Logger name="test" additivity="false" >
<AppenderRef ref="Console" level="debug"/>
</Logger>
<root level="trace">
</root>
</loggers>
</configuration>