title: Logging request body and request headers with NLog
body: <p>I am using ASP .Net Core 2.1 WebAPI. Is it possible to log the current request body and headers with the configurations of the NLog?</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        autoReload="true"&gt;
    &lt;extensions&gt;
      &lt;add prefix="custom" assembly="Pepper" /&gt;
    &lt;/extensions&gt;
    &lt;variable name="log-header" 
              value="Time: [${date}]${newline}
              Operation: ${aspnet-request-method} ${aspnet-request-url:IncludeHost=true:IncludePort=true:IncludeQueryString=true}${newline}
              Headers:${aspnet-request-headers}${newline}
              Body:${aspnet-request-body}"/&gt;
    &lt;targets&gt;
      &lt;target name="exceptionFile" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard"&gt;
        &lt;target xsi:type="File" 
                encoding="utf-8" 
                fileName="exception_log.txt" 
                archiveAboveSize="10000000" 
                archiveNumbering="Sequence" 
                maxArchiveFiles="10" 
                layout="${log-header}${newline}${message}${newline}${newline}" /&gt;
      &lt;/target&gt;
    &lt;/targets&gt;
    &lt;rules&gt;
      &lt;logger name="*" minlevel="Error" writeTo="exceptionFile" /&gt;
    &lt;/rules&gt;
  &lt;/nlog&gt;
  </code></pre>