Advertisement
uraharadono

NLog

Mar 7th, 2016
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.74 KB | None | 0 0
  1. 1. Skini NLog sa http://nlog-project.org/
  2. 2. Napravi folder "logs" u projektu
  3. 3. Izmjeni "NLog.config" ovako:
  4.  
  5.  
  6. <?xml version="1.0" encoding="utf-8" ?>
  7. <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
  8.      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9.      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
  10.      autoReload="true"
  11.      throwExceptions="false"
  12.      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log" >
  13.  
  14.  
  15.   <!-- optional, add some variabeles
  16.  https://github.com/nlog/NLog/wiki/Configuration-file#variables
  17.  -->
  18.   <variable name="logDirectory" value="${basedir}/logs/"/>
  19.   <!--
  20.  See https://github.com/nlog/nlog/wiki/Configuration-file
  21.  for information on customizing logging rules and outputs.
  22.   -->
  23.   <targets>
  24.     <target name="f" xsi:type="File" fileName="${logDirectory}/logfile${shortdate}.txt"  layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=tostring,StackTrace}"/>
  25.     <!--
  26.    add your targets here
  27.    See https://github.com/nlog/NLog/wiki/Targets for possible targets.
  28.    See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
  29.    -->
  30.  
  31.     <!--
  32.    Writing events to the a file with the date in the filename.
  33.    <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
  34.            layout="${longdate} ${uppercase:${level}} ${message}" />
  35.    -->
  36.   </targets>
  37.  
  38.   <rules>
  39.     <!-- add your logging rules here -->
  40.  
  41.     <!--
  42.    Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace)  to "f"
  43.    <logger name="*" minlevel="Debug" writeTo="f" />
  44.    -->
  45.  
  46.     <logger name="*" writeTo="f" />
  47.   </rules>
  48. </nlog>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement