我已將NLog添加到我的項目和開發環境中,它工作正常。NLog不寫入
我創建了一個安裝文件來部署我的應用程序。 NLog.config文件在安裝項目中沒有顯示爲依賴項。所以,我將它添加爲一個文件,並在部署時與exe文件和App.config位於同一目錄中。
它不做任何記錄。我不知道爲什麼。下面是配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<variable name="day" value="${date:format=dd}" />
<variable name="month" value="${date:format=MM}" />
<variable name="year" value="${date:format=yyyy}" />
<variable name="verbose" value="${longdate} | ${level} | ${message} | ${exception:format=tostring,message,method:maxInnerExceptionLevel=5:innerFormat=shortType,message,method}}" />
<targets>
<target name="logfile" xsi:type="File" fileName="${basedir}/Logs/${year}${month}${day}.log" layout="${verbose}" />
</targets>
<rules>
<logger name="*" minlevel="Error" writeTo="logfile" />
</rules>
</nlog>
任何幫助將是巨大的。乾杯!
xsi標籤卡住一個錯誤。我怎樣才能在那裏獲得架構? – onefootswill 2012-04-23 23:06:14
粘貼您自己的配置,xmlns屬性和全部。爲了可讀性,我刪除了一些東西(因此是點)。也;見例如http://snipplr.com/view/24560/和http://nlog-project.org/wiki/Visual_Studio_support – BaBu 2012-04-24 06:07:57
這東西看起來不錯。我會着手解決這個問題。 – onefootswill 2012-04-26 03:42:10