1
任何人都可以請讓我知道一個包的過濾器屬性,其中 我想將日誌分成兩個不同的日誌文件。下面是我嘗試使用的配置,但它不工作。我想要拒絕日誌 基於字符串,如'UserMgmt-',並允許休息日誌在log1 appender中,並且只允許log2 appender允許'UserMgmt-'並且拒絕休息允許日誌。Log4j StringMatchFilter和denyAll過濾器屬性配置
log4j.logger.com.abc=DEBUG, log1
log4j.logger.com.abc=DEBUG, log2
log4j.appender.log1=org.apache.log4j.RollingFileAppender
log4j.appender.log1.Append=true
log4j.appender.log1.File=C:/Oracle/Middleware/user_projects/domains/logs/G_loAFg/UM.log
log4j.appender.log1.layout=org.apache.log4j.PatternLayout
log4j.appender.log1.layout.ConversionPattern=%d %-6p [%c] %m%n
log4j.appender.log1.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.log1.filter.1.StringToMatch=UserMgmt-
log4j.appender.log1.filter.1.AcceptOnMatch=false
log4j.appender.log2=org.apache.log4j.RollingFileAppender
log4j.appender.log2.Append=true
log4j.appender.log2.File=C:/Oracle/Middleware/user_projects/domains/logs/PM.log
log4j.appender.log2.layout=org.apache.log4j.PatternLayout
log4j.appender.log2.layout.ConversionPattern=%d %-6p [%c] %m%n
log4j.appender.log2.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.log2.filter.1.StringToMatch=UserMgmt-
log4j.appender.log2.filter.1.AcceptOnMatch=true