繁体   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