Nlog突然停止在Linux上创建日志文件,但在Windows上可以正常工作 [英] Nlog suddenly stopped creating log files on Linux, but it works on windows

查看:668
本文介绍了Nlog突然停止在Linux上创建日志文件,但在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=\&#xD;&#xA;}${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配置:将以下属性添加到<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

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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆