簡體   English   中英

為什么 nLog 寫日志 hwen exe 運行時在 nUnit 中運行時什么也沒有

[英]Why is nLog writing logs hwen exe is run and nothing when run in nUnit

我正在運行集成測試並希望查看日志。 現在,如果我執行控制台應用程序 .net 4.8,我會得到一個預期的文件 output。

如果我運行 nUnit 集成測試甚至沒有創建文件?

nLog.config 始終部署到測試文件夾並存在。 這是設計使然嗎? 在測試控制台應用程序期間如何修復/打開日志記錄

<target name="filelogTest" type="File"
        fileName="${basedir}/log/Test${longdate:cached=true}.log" 
        layout="${date}: Session [${scopeproperty:item=SessionContext}] Level [${level}], message :[${message}],"
        keepFileOpen="true"
        openFileCacheTimeout="5"
        concurrentWrites="true"> </target>
<rules>
    <logger name="*" minlevel="Trace" writeTo="filelogTest" />
</rules>

答案很簡單,exe 和單元測試的相對路徑不同,我看錯了地方。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM