NLog.config 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3. <variable name="appType" value="" />
  4. <variable name="appId" value="" />
  5. <targets>
  6. <target name="all" xsi:type="File"
  7. fileName="${basedir}/../Logs/Log.txt"
  8. deleteOldFileOnStartup="false"
  9. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
  10. </targets>
  11. <targets>
  12. <target name="trace" xsi:type="File"
  13. fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Trace.txt"
  14. deleteOldFileOnStartup="false"
  15. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
  16. <target name="trace" type="ColoredConsole"
  17. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
  18. </targets>
  19. <targets>
  20. <target name="debug" xsi:type="File"
  21. fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Debug.txt"
  22. deleteOldFileOnStartup="false"
  23. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
  24. <target name="debug" type="ColoredConsole"
  25. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
  26. </targets>
  27. <targets>
  28. <target name="info" xsi:type="File"
  29. fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Info.txt"
  30. deleteOldFileOnStartup="false"
  31. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
  32. <target name="info" type="ColoredConsole"
  33. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
  34. </targets>
  35. <targets>
  36. <target name="error" xsi:type="File"
  37. fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Error.txt"
  38. deleteOldFileOnStartup="false"
  39. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
  40. <target name="error" type="ColoredConsole"
  41. layout="${longdate} ${var:appTypeFormat} ${var:appIdFormat} ${message} ${newline} ${stacktrace:format=Raw:topFrames=10:skipFrames=0}" />
  42. </targets>
  43. <rules>
  44. <logger name="*" minlevel="Trace" writeTo="all" />
  45. <logger name="*" minlevel="Trace" maxlevel="Trace" writeTo="trace" />
  46. <logger name="*" minlevel="Debug" maxlevel="Debug" writeTo="debug" />
  47. <logger name="*" minlevel="Info" maxlevel="Info" writeTo="info" />
  48. <logger name="*" minlevel="Error" writeTo="error" />
  49. </rules>
  50. </nlog>