Advertisement
amironov73

NLog configuration file example

Jan 20th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 0.84 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
  3.      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4.      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
  5.      autoReload="true"
  6.      throwExceptions="false"
  7.      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
  8.  
  9.   <variable name="myformat"
  10.         value="${longdate} | ${level} | ${logger} | ${message} | ${exception:format=toString}"/>
  11.  
  12.   <targets>
  13.  
  14.     <target xsi:type="ColoredConsole" name="console"
  15.             layout="${myformat}" />
  16.  
  17.     <target xsi:type="File" name="file"
  18.             fileName="log.txt" layout="${myformat}" />
  19.  
  20.   </targets>
  21.  
  22.   <rules>
  23.  
  24.     <logger name="*" minlevel="Trace" writeTo="file" />
  25.    
  26.     <logger name="*" minlevel="Debug" writeTo="console" />
  27.  
  28.   </rules>
  29. </nlog>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement