title: Log4j2 export XML configuration
body: <p>In my project I need to load a &quot;default&quot; log4j2 XML configuration, then modify it and then save it in order to reload on next opening.</p>
  <p>I found how to modify the configuration but I didn't find how to generate the XML from the configuration.</p>
  <pre><code>final LoggerContext context = (LoggerContext) LogManager.getContext(false);
  final Configuration config = context.getConfiguration();
  
  // changes here...
  
  // generate XML file &amp; save it from the config
  </code></pre>