[英]Why is my NLog configuration not working on my server machine?
我正在使用ServiceStack框架和NLog进行日志记录。 我可以很好地登录我的本地机器。 但是在服务器上,它没有。 我检查过Nlog.config
是否在bin
目录中,整个目录,包括bin
目录上面的目录都有写访问权限。
下面是配置文件的片段:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets async="true">
<target xsi:type="File" name="file" fileName="${basedir}\logs\${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}" />
<target xsi:type="Debugger" name="debug"
header="===== ${date:format=ddd, dd MMM yyyy} ${time} ====="
layout="${level} | ${logger} | ${message} | ${onexception:${exception:format=tostring} | ${stacktrace}}"
footer="===== end of session ===== ${newline}"
/>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="file,debug" />
</rules>
</nlog>
可能是什么问题?
你有没有试过改变你知道的东西?
而不是fileName="${basedir}\\logs\\${shortdate}.log"
而不是像fileName="c:\\logs\\${shortdate}.log"
?
Web应用程序中NLog的basedir
变量不在bin文件夹中运行。 我想你会在里面找到日志文件
%SystemRoot%\Microsoft.NET\Framework\versionNumber\Temporary ASP.NET Files
如果它是一个ASP.NET应用程序。
虽然我不知道您的服务器环境和配置有什么问题但我总是发现检查以下内容很有帮助:
FWIW,根据我的经验,它通常是一个权限问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.