title: Can't Create RollingFileAppender with System property variable
body: <p>While creating RollingFileAppender with a System property variable I got the following error.</p>
  
  <pre><code>ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.reflect.InvocationTargetException
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)
  at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)
  at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)
  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:566)
  at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:582)
  at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:217)
  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:152)
  at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:45)
  at org.apache.logging.log4j.LogManager.getContext(LogManager.java:194)
  at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:551)
  at com.hifx.lens.services.AvroSerializerFactory.&lt;init&gt;(AvroSerializerFactory.java:16)
  at com.hifx.lens.services.AvroSerializerFactory.init(AvroSerializerFactory.java:43)
  at com.hifx.lens.Accumulo.main(Accumulo.java:31)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
  Caused by: java.lang.ClassCastException: org.apache.logging.log4j.core.appender.FileManager cannot be cast to org.apache.logging.log4j.core.appender.rolling.RollingFileManager
  at org.apache.logging.log4j.core.appender.rolling.RollingFileManager.getFileManager(RollingFileManager.java:103)
  at org.apache.logging.log4j.core.appender.RollingFileAppender.createAppender(RollingFileAppender.java:191)
  ... 27 more
  </code></pre>
  
  <p>My log4j2.yml configuration file is </p>
  
  <pre><code>    Configutation:
      name: Default
      Properties:
          Property:
            name: LOG_PATH
            value: "logs"
        Appenders:
          Console:
            name: Console_Appender
            target: SYSTEM_OUT
            PatternLayout:
              pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
      File:
        name: File_Appender
        fileName: ${sys:LOG_PATH}/log.log
        PatternLayout:
          pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
  
      RollingFile:
        name: RollingFile_Appender
        fileName: ${sys:LOG_PATH}/log.log
        filePattern: "logs/archive/rollingfile.log.%d{yyyy-MM-dd-hh-mm}.gz"
        PatternLayout:
          pattern: "[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"
        Policies:
          SizeBasedTriggeringPolicy:
            size: 100 KB
        DefaultRollOverStrategy:
          max: 30
  
    Loggers:
      Root:
        level: debug
        AppenderRef:
          - ref: RollingFile_Appender
  
      Logger:
            - name: Accumulo_File_logger
              level: debug
              AppenderRef:
                - ref: File_Appender
  </code></pre>
  
  <p>If I change the filename of RollingFile_Appender to using property name ie: </p>
  
  <pre><code>fileName: ${LOG_PATH}/log.log 
  </code></pre>
  
  <p>then the error is disappeared and everything working fine.</p>
  
  <p>If I use the File_Appender( which is also using the same System property variable(sys:LOG_PATH)) then also everything working fine.</p>
  
  <p>Same error if I change sys: to env:
  I think there is some parsing issue with the jackson.
  I need to configure the log path from environment variables.</p>
  
  <p>Dependencies using are</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-api&lt;/artifactId&gt;
          &lt;version&gt;2.6.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;2.6.2&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.dataformat&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-dataformat-yaml&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;        
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.2.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-jcl&lt;/artifactId&gt;
          &lt;version&gt;2.6.2&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>Somebody please help me</p>