【发布时间】:2021-05-13 18:47:16
【问题描述】:
我在我的 asp.net core 2.0 应用程序中使用 NLog,我想将它部署到 Ubuntu。我可以找到很多线程和文章,但它们都部署在 Windows 中。
我的 nlog.config sn-p 如下所示,
<target xsi:type="File" name="ownlog" fileName="${var:configDir}\nlog-own.log"
layout="${longdate}|${event-properties:item=EventId.Id}|${logger}|${uppercase:${level}}| ${message} ${exception}" />
在我的 Startup.cs 文件中,我将 configDir 设置如下,
LogManager.Configuration.Variables["configDir"] = "\\var\\log";
它不起作用。任何人都可以帮忙吗?如何将日志文件存储在 \var\log 文件夹中?
谢谢
【问题讨论】:
-
您是否尝试过反转斜线,使它们变成 unix 样式: /var/log/nlog-own.log ?您是否尝试过检查文件权限?你检查过 NLog InternalLogger 吗? (github.com/NLog/NLog/wiki/Internal-Logging)
标签: c# linux asp.net-core nlog