title: How to add Log4J2 appenders at runtime programmatically?
body: <p>Is it possible to add Log4J2 appenders programmatically using the specifications from the XML configuration?</p>
  
  <p>I plan to define it all in the log4j2.xml and then pick appenders situationally like this (won't compile):</p>
  
  <pre><code>if (arg[0].equals("log") ) {
      Logger.getLogger("loggerNameFromXMLConfig").addAppender("appenderNameFromXMLConfig");
  } else {
      //...
  }
  </code></pre>