NLog: Nlog.Config 4.6.8 is not work in linux by publishing with single file(service)
hi Nlog developers,
I published my NetCore 3.1 Web API Service in Linux with single file(service) and set Nlog 4.6.8 for this:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="true"
internalLogLevel="Error" internalLogFile="${basedir}/../logs/logfail.txt">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue"/>
<targets>
<target xsi:type="File" name="f1" fileName="${basedir:fixtempdir=true}/../logs/Normal/${shortdate}.txt"
layout="${longdate} ${newline} ${uppercase:${level}} ${message} ${newline}" />
<target xsi:type="File" name="f2" fileName="${basedir:fixtempdir=true}/../logs/Error/${shortdate}.txt"
layout="${longdate} ${newline} ${message} ${newline}" />
<target xsi:type="File" name="f3" fileName="${basedir:fixtempdir=true}/../logs/Fatal/${shortdate}.txt"
layout="${longdate} ${newline} ${message} ${newline}" />
<target xsi:type="File" name="f4" fileName="${basedir:fixtempdir=true}/../logs/Info/${shortdate}.txt"
layout="${longdate} ${newline} ${message} ${newline}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" maxlevel="Warn" writeTo="f1" />
<logger name="*" level="Error" writeTo="f2" />
<logger name="*" level="Fatal" writeTo="f3" />
<logger name="*" level="Info" writeTo="f4" />
</rules>
</nlog>
and I read some same issues and changed this from ${BaseDir} to ${BaseDir:FixTempDir=true},but it is still not work…
by the way, before I set Single file, it always worked in linux. please help me to solve this issue thanks 😃
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 35 (22 by maintainers)
It is okay. You have helped a lot already. But if you get the time, to confirm if the provided pre-release-build resolves the issue (When not using NLog.config-nuget-package), then please tell 😃
P.S. There is already a warning at https://www.nuget.org/packages/NLog.config saying:
I guess the “warning” could be more precise, about the nuget-package breaking application logging by unexpected reset of NLog.config file 😃
sorry for my late response and I m glad to help you for this issue.