LOG4J简单配置
< 返回列表时间: 2019-07-08来源:OSCHINA
【围观】麒麟芯片遭打压成绝版,华为亿元投入又砸向了哪里?>>> <?xml version="1.0" encoding="UTF-8"?> <configuration status="info"> <appenders> <!--默认按天&按512M文件大小切分日志,默认最多保留30个日志文件,非阻塞模式--> <XMDFile name="infoAppender" fileName="info.log" sizeBasedTriggeringSize="512M" rolloverMax="30"> <Filters> <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/> </Filters> </XMDFile> <XMDFile name="warnAppender" fileName="warn.log" sizeBasedTriggeringSize="512M" rolloverMax="30"> <Filters> <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/> </Filters> </XMDFile> <XMDFile name="errorAppender" fileName="error.log" sizeBasedTriggeringSize="512M" rolloverMax="30"> <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/> </XMDFile> <!--日志远程上报--> <Scribe name="ScribeAppender"> <!--远程日志默认使用appkey作为日志名(app.properties文件中的app.name字段),也可自定义scribeCategory属性,scribeCategory优先级高于appkey--> <LcLayout/> </Scribe> <Async name="ScribeAsyncAppender" blocking="false"> <AppenderRef ref="ScribeAppender"/> </Async> <CatAppender name="catAppender"/> </appenders> <loggers> <!--远程日志--> <logger name="scribe" level="info" additivity="false"> <appender-ref ref="ScribeAsyncAppender" /> </logger> <root level="info"> <appender-ref ref="infoAppender"/> <appender-ref ref="warnAppender"/> <appender-ref ref="errorAppender"/> <appender-ref ref="catAppender"/> </root> </loggers> </configuration>
热门排行