You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Viraj Jasani (Jira)" <ji...@apache.org> on 2023/01/26 09:07:00 UTC

[jira] [Created] (LOG4J2-3648) No appender references provided to AsyncAppender: appenderRefs

Viraj Jasani created LOG4J2-3648:
------------------------------------

             Summary: No appender references provided to AsyncAppender: appenderRefs
                 Key: LOG4J2-3648
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3648
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.17.2
            Reporter: Viraj Jasani


Using log4j2.properties to define AsyncAppender and have RFA added to the AsyncAppender.

Properties content:
{code:java}
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
  {code}
This results in error:
{code:java}
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)
...
...
... {code}
Tried these options but they are not able to attach ref:
{code:java}
appender.ASYA.appenderRefs.ref = DRFA
appender.ASYA.appenderRefs.DRFA.ref = DRFA
appender.ASYA = DRFA {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)