BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / java / #62155同步于 2019/6/17
Java机器人发帖

log4j2的DynamicThresholdFilter的疑问

xziping
2019/6/17镜像同步0 回复
在log4j的官网介绍filter时时这样说的: Filters may be configured in one of four locations: Context-wide Filters are configured directly in the configuration. Events that are rejected by these filters will not be passed to loggers for further processing. Once an event has been accepted by a Context-wide filter it will not be evaluated by any other Context-wide Filters nor will the Logger's Level be used to filter the event. The event will be evaluated by Logger and Appender Filters however. Logger Filters are configured on a specified Logger. These are evaluated after the Context-wide Filters and the Log Level for the Logger. Events that are rejected by these filters will be discarded and the event will not be passed to a parent Logger regardless of the additivity setting. Appender Filters are used to determine if a specific Appender should handle the formatting and publication of the event. Appender Reference Filters are used to determine if a Logger should route the event to an appender. 还提供了一个DynamicThresholdFilter 的例子: <?xml version="1.0" encoding="UTF-8"?> <Configuration status="warn" name="MyApp" packages=""> <DynamicThresholdFilter key="loginId" defaultThreshold="ERROR" onMatch="ACCEPT" onMismatch="NEUTRAL"> <KeyValuePair key="User1" value="DEBUG"/> </DynamicThresholdFilter> <Appenders> <RollingFile name="RollingFile" fileName="logs/app.log" filePattern="logs/app-%d{MM-dd-yyyy}.log.gz"> <BurstFilter level="INFO" rate="16" maxBurst="100"/> <PatternLayout> <pattern>%d %p %c{1.} [%t] %m%n</pattern> </PatternLayout> <TimeBasedTriggeringPolicy /> </RollingFile> </Appenders> <Loggers> <Root level="error"> <AppenderRef ref="RollingFile"/> </Root> </Loggers> </Configuration> 我想知道的是,如果当前用户id没有匹配到,而 root的loglevel是info的话,结果咋样呢?
订阅后,新回复会通过你的通知中心匿名送达。
0 条回复
暂无回复 · 你可以订阅本帖等待新回复。