c# - 使用 Nlog 创建日志文件。创建引导程序包并使用它安装在我的机器上后,不会生成日志文件
问题描述
我的 NLog.config 文件:
<?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"
throwExceptions="true">
<targets>
<target name="logfile" xsi:type="File" fileName="${basedir}/log.txt" />
<target name="logconsole" xsi:type="Console" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logconsole" />
<logger name="*" minlevel="Debug" writeTo="logfile" />
</rules>
</nlog>
注意 1:我已经测试了这个文件的变体,但没有结果。
注意 2:通过 Visual Studio 日志记录运行应用程序可以正常工作。
我的设置是
编译动作:内容
复制到目录:始终复制
解决方案
推荐阅读
- tensorflow - 使用 TensorFlow 2 和 Keras 通过网络将多组输入传递到不同的损失函数中
- javascript - 输入框内的值没有改变
- java - 支持多达 ZonedDateTime 的多种格式作为请求参数;如果缺少,请设置默认时间和区域
- javascript - 根据场景格式化日期的正确方法
- javascript - 轮播 javascript 更改初始图像
- javascript - useState 创建无限循环
- python - 当我更改 PNG 文件时,Tkinter 性能会下降,但我不知道为什么
- sockets - 我们如何确定一个套接字是否准备好读/写?
- python - 从 NetCDF 数据创建时间序列
- javascript - 尝试在 PDF iframe Electron 中滚动时出现 CORS 错误