有一些log4j2系统日志的示例,用于使用键,值添加xml的日志优先级,但是log4j.properties
个文件我们无法将=
符号添加到值,我没有任何设置示例LoggerField用于设置RFS5454格式的优先级。
这是关闭LoggerFields for Syslog (output log priority and stack trace)
以下所有内容均不适用于LoggerField:
appender.sumo_syslog.loggerFields = {'key':'priority','value':'%p'} 要么 appender.sumo_syslog.loggerFields = [{'key':'priority','value':'%p'}] 要么 appender.sumo_syslog.loggerFields.keyValuePair = {'key':'priority','value':'%p'}
答案 0 :(得分:1)
您可以这样使用:
appender.syslog.type = Syslog
appender.syslog.name = syslog
appender.syslog.facility = LOCAL0
appender.syslog.host = X.X.X.X
appender.syslog.appName = API-TEST
appender.syslog.enterpriseNumber = 18060
appender.syslog.port = 514
appender.syslog.newLine = true
appender.syslog.protocol = TCP
appender.syslog.format = RFC5424
appender.syslog.messageId = Audit
appender.syslog.id = system1
appender.syslog.mdcId = mdc
appender.syslog.layout.type = loggerFields
appender.syslog.layout.pairs.type = KeyValuePair
appender.syslog.layout.pairs.key = category
appender.syslog.layout.pairs.value = %c
appender.syslog.layout.pairs2.type = KeyValuePair
appender.syslog.layout.pairs2.key = message
appender.syslog.layout.pairs2.value = %m
appender.syslog.layout.pairs3.type = KeyValuePair
appender.syslog.layout.pairs3.key = exception
appender.syslog.layout.pairs3.value = %ex