Log4j2自定义级别设置

时间:2019-07-18 16:10:47

标签: java log4j2

我正在尝试在log4j2属性文件中配置自定义级别,但是它不起作用。我尝试了许多不同的方法来配置它,但是没有一个起作用。这是代码中的几行:

customLevel.cl1.name = MY2
customLevel.cl1.intLevel = 10

appender.r4.type = RollingFile
appender.r4.name = userLog
appender.r4.filter.threshold.type = ThresholdFilter
appender.r4.filter.threshold.level = MY2
appender.r4.fileName = ${sys:user.home}/Vyv2.user
appender.r4.filePattern = ${sys:user.home}/Vyv2.user.%i
appender.r4.layout.type = PatternLayout
appender.r4.layout.pattern = %d{yyyy-MM-dd HH:mm:ss.SSS} [%-5level] [%t] %c - %msg%n
appender.r4.policies.type = Policies
appender.r4.policies.size.type = SizeBasedTriggeringPolicy
appender.r4.policies.size.size=100KB
appender.r4.strategy.type = DefaultRolloverStrategy
appender.r4.strategy.max = 10

rootLogger.level = ALL
rootLogger.appenderRef.l4.ref = userLog
rootLogger.appenderRef.l4.level = MY2

这部分不起作用:

customLevel.cl1.name = MY2
customLevel.cl1.intLevel = 10

为什么?谢谢

0 个答案:

没有答案