Click here to Skip to main content
15,886,777 members
Articles / Programming Languages / C#

Logging with NLog

Rate me:
Please Sign up or sign in to vote.
1.68/5 (13 votes)
6 Jan 20073 min read 52.3K   69   20  
The article describes how to configure nlog to log reports as per your requirement
<results>
  <test logger="Non-logging" repetitions="1000000">
    <timing name="No formatting" totalTime="00:00:00.0080000" repetitions="1000000" logsPerSecond="132232914.665682" nanosecondsPerLog="7.5624136587192" />
    <timing name="1 format parameter" totalTime="00:00:00.0080000" repetitions="1000000" logsPerSecond="122143758.95721" nanosecondsPerLog="8.18707405550147" />
    <timing name="2 format parameters" totalTime="00:00:00.0280000" repetitions="1000000" logsPerSecond="36267654.86636" nanosecondsPerLog="27.5727781044798" />
    <timing name="3 format parameters" totalTime="00:00:00.0350000" repetitions="1000000" logsPerSecond="28821741.4409482" nanosecondsPerLog="34.6960298026705" />
    <timing name="No formatting, using a guard" totalTime="00:00:00.0070000" repetitions="1000000" logsPerSecond="144324852.834449" nanosecondsPerLog="6.92881357826204" />
    <timing name="1 format parameter, using a guard" totalTime="00:00:00.0070000" repetitions="1000000" logsPerSecond="142356134.420362" nanosecondsPerLog="7.02463581265217" />
    <timing name="2 format parameters, using a guard" totalTime="00:00:00.0070000" repetitions="1000000" logsPerSecond="144330672.150317" nanosecondsPerLog="6.9285342131472" />
    <timing name="3 format parameters, using a guard" totalTime="00:00:00.0070000" repetitions="1000000" logsPerSecond="144330672.150317" nanosecondsPerLog="6.9285342131472" />
  </test>
  <test logger="Null-appender without layout" repetitions="1000000">
    <timing name="No formatting" totalTime="00:00:00.1590000" repetitions="1000000" logsPerSecond="6294225.63271163" nanosecondsPerLog="158.875778904861" />
    <timing name="1 format parameter" totalTime="00:00:00.2010000" repetitions="1000000" logsPerSecond="4979820.81495806" nanosecondsPerLog="200.810438198151" />
    <timing name="2 format parameters" totalTime="00:00:00.2130000" repetitions="1000000" logsPerSecond="4705061.60733768" nanosecondsPerLog="212.537068258675" />
    <timing name="3 format parameters" totalTime="00:00:00.2330000" repetitions="1000000" logsPerSecond="4289027.32146152" nanosecondsPerLog="233.153096273409" />
    <timing name="No formatting, using a guard" totalTime="00:00:00.1610000" repetitions="1000000" logsPerSecond="6212880.69579223" nanosecondsPerLog="160.95593154996" />
    <timing name="1 format parameter, using a guard" totalTime="00:00:00.2060000" repetitions="1000000" logsPerSecond="4862574.06859003" nanosecondsPerLog="205.652394368558" />
    <timing name="2 format parameters, using a guard" totalTime="00:00:00.2180000" repetitions="1000000" logsPerSecond="4588807.27123555" nanosecondsPerLog="217.921551482102" />
    <timing name="3 format parameters, using a guard" totalTime="00:00:00.2370000" repetitions="1000000" logsPerSecond="4223886.16241845" nanosecondsPerLog="236.748804666515" />
  </test>
  <test logger="Null-appender with layout rendering" repetitions="1000000">
    <timing name="No formatting" totalTime="00:00:02.7100000" repetitions="1000000" logsPerSecond="369043.367488961" nanosecondsPerLog="2709.70863615348" />
    <timing name="1 format parameter" totalTime="00:00:03.7000000" repetitions="1000000" logsPerSecond="270289.688459089" nanosecondsPerLog="3699.73418409323" />
    <timing name="2 format parameters" totalTime="00:00:03.8000000" repetitions="1000000" logsPerSecond="263152.516487902" nanosecondsPerLog="3800.07766350193" />
    <timing name="3 format parameters" totalTime="00:00:04.0620000" repetitions="1000000" logsPerSecond="246186.326352651" nanosecondsPerLog="4061.96402056686" />
    <timing name="No formatting, using a guard" totalTime="00:00:02.6320000" repetitions="1000000" logsPerSecond="379986.618100044" nanosecondsPerLog="2631.67162306941" />
    <timing name="1 format parameter, using a guard" totalTime="00:00:03.4930000" repetitions="1000000" logsPerSecond="286322.163456505" nanosecondsPerLog="3492.56930699293" />
    <timing name="2 format parameters, using a guard" totalTime="00:00:03.6730000" repetitions="1000000" logsPerSecond="272257.378903654" nanosecondsPerLog="3672.99503149143" />
    <timing name="3 format parameters, using a guard" totalTime="00:00:04.0670000" repetitions="1000000" logsPerSecond="245881.747169287" nanosecondsPerLog="4066.99566565024" />
  </test>
</results>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions