Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just happened to stumble on this while looking at replicating a header/footer in a log one of my co-workers created with log4net. I found this from some open-source project and adapted it as an internal example. I think it should be simple to modify for your needs.</p> <pre class="lang-xml prettyprint-override"><code>&lt;target name="logfile2" xsi:type="File" fileName="Logs\NLogDemo2.txt"&gt; &lt;layout xsi:type="LayoutWithHeaderAndFooter"&gt; &lt;header xsi:type="SimpleLayout" text="----------NLog Demo Starting---------&amp;#xD;&amp;#xA;"/&gt; &lt;layout xsi:type="SimpleLayout" text="${longdate}|${level:uppercase=true}|${logger}|${message}" /&gt; &lt;footer xsi:type="SimpleLayout" text="----------NLog Demo Ending-----------&amp;#xD;&amp;#xA;"/&gt; &lt;/layout&gt; &lt;/target&gt; </code></pre> <p>It gives me output that looks like this:</p> <pre><code>----------NLog Demo Starting--------- 2013-03-01 16:40:19.5404|INFO|Project.Form1|Sample informational message 2013-03-01 16:40:19.5714|WARN|Project.Form1|Sample warning message 2013-03-01 16:40:19.5714|ERROR|Project.Form1|Sample error message 2013-03-01 16:40:19.5714|FATAL|Project.Form1|Sample fatal error message ----------NLog Demo Ending----------- </code></pre> <p>I have no idea why this seems to be undocumented. The only reference I could find was here: <a href="https://github.com/nlog/NLog/wiki/LayoutWithHeaderAndFooter" rel="nofollow noreferrer">https://github.com/nlog/NLog/wiki/LayoutWithHeaderAndFooter</a></p> <p>-Jody</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload