Nlog 突然停止在 Linux 上创建日志文件,但它在 Windows 上工作 [英] Nlog suddenly stopped creating log files on Linux, but it works on windows
问题描述
我的应用程序指向 .net 核心框架 1.1.1.
My application is pointing to .net core framework 1.1.1.
我已将 NLog 添加到我的项目中.
I have added NLog to my project.
NLog - 5.0.0-beta05
NLog - 5.0.0-beta05
NLog.Config - 4.3.9
NLog.Config - 4.3.9
NLog.Extensions.Logging - 1.0.0-rtm-beta1
NLog.Extensions.Logging - 1.0.0-rtm-beta1
我的 NLog 配置文件如下:
My NLog config file is as follows:
<target name="infoInstrumentation"
xsi:type="File"
concurrentWrites="false"
archiveFileName="/home/ubuntu/Desktop/Logs/Punu/ServiceInstrumentation.${shortdate}.{##}.log"
archiveAboveSize="1000000"
archiveNumbering="Rolling"
maxArchiveFiles="10"
fileName="/home/ubuntu/Desktop/Logs/Punu/ServiceInstrumentation.${shortdate}.log"
layout="Timestamp: ${date}${newline}${all-event-properties:format=[key]: [value]:separator=
}${newline}Message: ${message}${newline}Machine: ${machinename}${newline}${newline}${LayoutFooter}"
keepFileOpen="false">
</target>
日志记录在 Windows 上工作,但是当我在 Linux 上测试代码时,它无法写入.几天前它在 Linux 上工作,但现在它完全停止了.
Logging works on windows, but when I test code on Linux, it fails to write. Few days before it was working with Linux, but now it has stopped completely.
推荐答案
由于看起来像是 NLog 库的问题,您可以尝试对 NLog 进行故障排除.例如,您可以启用 NLog 内部日志记录并检查是否有任何问题.
As it looks like a problem with NLog library, you may try to troubleshoot NLog. For example, you may enable NLog internal logging and check if there are any problems.
修改NLog配置:在
部分添加以下属性
Modify NLog config: add the following attributes into <nlog>
section
internalLogLevel="Warn"
internalLogFile="internal-nlog.txt"
查看日志-故障排除 NLog wiki 有关更多示例,尤其是阅读内部日志记录"部分.
Look into Logging-troubleshooting NLog wiki for more examples, especially read "Internal logging" section.
也许你有同样的问题,在这里讨论(github上的问题):无法创建/使用 NLog 5.0.0-beta01 + beta02 写入登录 linux 服务器
Maybe you have the same problem, discussed here (issue on github): Unable to create/write to log on linux server using NLog 5.0.0-beta01 + beta02
这篇关于Nlog 突然停止在 Linux 上创建日志文件,但它在 Windows 上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!