-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Description
Using log4j2.properties to define AsyncAppender and have RFA added to the AsyncAppender. Somehow the appender ref is not correctly getting identified and hence it's resulting in error.
Configuration
Version: 2.17.2
Operating system: MacOS 13.2
JDK: 1.8.0_341
log4j2.properties:
appender.DRFA.type = RollingFile
appender.DRFA.name = DRFA
appender.DRFA.fileName = xyz
appender.DRFA.filePattern = xyz
appender.DRFA.createOnDemand = true
appender.DRFA.layout.type = PatternLayout
appender.DRFA.layout.pattern = %d{ISO8601} %-5p [%t] %c{2}: %.1000m%n
appender.DRFA.policies.type = Policies
appender.DRFA.policies.time.type = TimeBasedTriggeringPolicy
appender.DRFA.policies.time.interval = 1
appender.DRFA.policies.time.modulate = true
appender.DRFA.policies.size.type = SizeBasedTriggeringPolicy
appender.DRFA.policies.size.size = 256MB
appender.DRFA.strategy.type = DefaultRolloverStrategy
appender.DRFA.strategy.max = 20
appender.ASYA.type = Async
appender.ASYA.name = ASYA
appender.ASYA.appenderRefs = DRFA
appender.ASYA.blocking = true
appender.ASYA.bufferSize = 256
This results in error:
2023-01-26 00:58:07,944 main ERROR No appender references provided to AsyncAppender: appenderRefs
2023-01-26 00:58:07,951 main DEBUG AsyncAppender$Builder(={}, errorRef="null", blocking="true", shutdownTimeout="null", bufferSize="256", name="ASYA", includeLocation="null", Configuration(PropertiesConfig), ignoreExceptions="null", BlockingQueueFactory=null, Filter=null, ={})
2023-01-26 00:58:07,951 main ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.AsyncAppender for element Async org.apache.logging.log4j.core.config.ConfigurationException: Arguments given for element Async are invalid: field 'appenderRefs' has invalid value '[Lorg.apache.logging.log4j.core.config.AppenderRef;@35cabb2a'
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.injectFields(PluginBuilder.java:212)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:123)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1122)
...
...
...
Tried these options but they are not able to attach ref:
appender.ASYA.appenderRefs.ref = DRFA
appender.ASYA.appenderRefs.DRFA.ref = DRFA
appender.ASYA = DRFA
Metadata
Metadata
Assignees
Labels
No labels