2012-05-16 26 views
21

ウェブサイトのプロジェクトへのファイルの相対を作成し、私はNugetからNlogを追加し、次のNLogの設定は使用されません:はNlogは、私は、ウェブサイトのプロジェクトを使用しています

<?xml version="1.0" encoding="utf-8" ?> 
<nlog autoReload="true" 
     throwExceptions="true" 
     xmlns="http://www.nlog-project.org/schemas/NLog.xsd" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <targets> 
     <target name="logfile" xsi:type="File" fileName="log.txt" /> 
    </targets> 

    <rules> 
     <logger name="*" minlevel="Info" writeTo="logfile" /> 
    </rules> 
</nlog> 

私はProcessMonitorを走ったが、それはNlogを作成しようとしていることを示しています私のウェブサイトのプロジェクトフォルダの代わりにIISExpressフォルダのlog.txt。

C:\プログラムファイル(x86の)\ IIS Expressの\は

をlog.txtをどのように私はNLogではなくIISExpressフォルダの私のウェブサイトのプロジェクトのフォルダ内に、私のログファイル、log.txtを置くことができますか?

答えて

42

私たちはそれを理解しました。

filename="${basedir}/log.txt" 
+0

ちなみにファイル名に${basedir}を追加し、これはもはや必要とすべきではありません。バージョン4.3の相対パスは '$ {basedir}'に相対的に計算されるべきです。 Tempus fugit。 –

関連する問題