12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?xml version="1.0" ?>
- <!--<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- autoReload="true"
- internalLogLevel="Trace"
- internalLogFile="D:\work\log.txt">-->
- <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- autoReload="true">
- <targets>
- <!-- Log in a separate thread, possibly queueing up to
- messages. When the queue overflows, discard any
- extra messages-->
- <!-- write logs to file -->
- <target name="file" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
- <target xsi:type="File" fileName="${basedir}/nlogs/${shortdate}.log"
- layout="${longdate} ${level:uppercase=true} ${event-context:item=Action} ${message} ${event-context:item=Amount}" />
- </target>
- <!-- write log message to database -->
- <!--<target name="db" xsi:type="AsyncWrapper" queueLimit="5000" overflowAction="Discard">
- <target type="Database" dbProvider="mssql" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=EFinance;Persist Security Info=True;User ID=sa;Password=123456;">
- <commandText>
- INSERT INTO Log(Timestamp,Level,Message,Action,Amount,StackTrace) VALUES(@time_stamp, @level, @message, @action, @amount, @stacktrace);
- </commandText>
- --><!-- database connection parameters --><!--
- <parameter name="@time_stamp" layout="${date}" />
- <parameter name="@level" layout="${level:uppercase=true}" />
- <parameter name="@message" layout="${message}" />
- <parameter name="@action" layout="${event-context:item=Action}" />
- <parameter name="@amount" layout="${event-context:item=Amount}" />
- <parameter name="@stacktrace" layout="${stacktrace}" />
- </target>
- </target>-->
- <!--write log message to Visual Studio Output-->
- <!--<target name="debugger" xsi:type="Debugger" layout="NLog: ${date:format=HH\:mm\:ss} | ${level:uppercase=true:padding=-5} | ${message}" />-->
- </targets>
- <rules>
- <!--TRACE,DEBUG,INFO,WARN,ERROR,FATAL-->
- <!--<logger name="*" minlevel="Trace" writeTo="debugger" />-->
- <!--INFO,WARN,ERROR,FATAL-->
- <!--<logger name="*" minlevel="Info" writeTo="db" />-->
- <!--DEBUG,INFO,WARN,ERROR,FATAL-->
- <logger name="*" minlevel="Trace" writeTo="file" />
- </rules>
- </nlog>
|