NLog.config 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" ?>
  2. <!--<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. autoReload="true"
  5. internalLogLevel="Trace"
  6. internalLogFile="D:\work\log.txt">-->
  7. <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
  8. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. autoReload="true">
  10. <targets>
  11. <!-- Log in a separate thread, possibly queueing up to
  12. messages. When the queue overflows, discard any
  13. extra messages-->
  14. <!-- write logs to file -->
  15. <target name="file" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
  16. <target xsi:type="File" fileName="${basedir}/nlogs/${shortdate}/${var:catalog}.log"
  17. layout="${longdate} ${level:uppercase=true} ${event-context:item=Action} ${message} ${event-context:item=Amount}" />
  18. </target>
  19. <!-- write log message to database -->
  20. <!--<target name="db" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
  21. <target type="Database" dbProvider="mssql" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=EFinance;Persist Security Info=True;User ID=sa;Password=123456;">
  22. <commandText>
  23. INSERT INTO Log(Timestamp,Level,Message,Action,Amount,StackTrace) VALUES(@time_stamp, @level, @message, @action, @amount, @stacktrace);
  24. </commandText>
  25. -->
  26. <!-- database connection parameters -->
  27. <!--
  28. <parameter name="@time_stamp" layout="${date}" />
  29. <parameter name="@level" layout="${level:uppercase=true}" />
  30. <parameter name="@message" layout="${message}" />
  31. <parameter name="@action" layout="${event-context:item=Action}" />
  32. <parameter name="@amount" layout="${event-context:item=Amount}" />
  33. <parameter name="@stacktrace" layout="${stacktrace}" />
  34. </target>
  35. </target>-->
  36. <!--write log message to Visual Studio Output-->
  37. <!--<target name="debugger" xsi:type="Debugger" layout="NLog: ${date:format=HH\:mm\:ss} | ${level:uppercase=true:padding=-5} | ${message}" />-->
  38. </targets>
  39. <rules>
  40. <!--TRACE,DEBUG,INFO,WARN,ERROR,FATAL-->
  41. <!--<logger name="*" minlevel="Trace" writeTo="debugger" />-->
  42. <!--INFO,WARN,ERROR,FATAL-->
  43. <!--<logger name="*" minlevel="Info" writeTo="db" />-->
  44. <!--DEBUG,INFO,WARN,ERROR,FATAL-->
  45. <logger name="*" minlevel="Trace" writeTo="file" />
  46. </rules>
  47. </nlog>