title: How do I write to a CSV file using the apache log4j2 functionality and the log4j2 configuration file?
body: <p>I have been trying hard to generate a CSV file using CsvParameterLayout in Log4j. I have coded the log4j2 configuration file as follows :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Configuration status="WARN"&gt;
  &lt;Properties&gt;
  &lt;Property name="csvLog.fileName"&gt;C:/ql/logs/csvLog&lt;/Property&gt;
  &lt;/Properties&gt;
  &lt;Appenders&gt;
  &lt;RollingFile name="csvFile" fileName="${csvLog.fileName}.tmp"
      filePattern="${csvLog.filename}-%d{MM-dd-yyyy}-%i.csv" header="${file-header}"&gt;
          &lt;CsvParameterLayout delimeter=","/&gt;
          &lt;Policies&gt;
                  &lt;TimeBasedTriggeringPolicy interval="1"
                      modulate="true" /&gt;
                  &lt;SizeBasedTriggeringPolicy size="10 MB" /&gt;
          &lt;/Policies&gt;
          &lt;DefaultRolloverStrategy max="200" /&gt;
      &lt;/RollingFile&gt;
  &lt;/Appenders&gt;
  &lt;Loggers&gt;
  &lt;Root level="debug" additivity="false"&gt;
          &lt;AppenderRef ref="csvFile" level="debug"/&gt;
      &lt;/Root&gt;
  &lt;/Loggers&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>However, I am not able to generate the required CSV file. Could anyone please help me on this? Also in the future, I want to add a unique ID before everything I am printing which I will generate using thread context.</p>
  
  <p>Please help.</p>