Reputation: 1394
I have asp.net core 1.1 app, which is running on Ubuntu 16.04. Logging is configured using NLog:
loggerFactory.AddNLog();
loggerFactory.ConfigureNLog("nlog.config");
app.AddNLogWeb();
On my dev Windows system everything is working fine: log folder created and logging is working as expected. But on Linux logging doesnt work. What is wrong?
nlog.config
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Warn"
internalLogFile="internal-nlog.txt">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<variable name="logDirectory" value="logs/${shortdate}" />
<variable name="logRootDirectory" value="logs" />
<targets>
<target name="fileLogTrace" xsi:type="File" fileName="${logDirectory}/trace.txt" />
<target name="fileLogDebug" xsi:type="File" fileName="${logDirectory}/debug.txt" />
<target name="fileLogInfo" xsi:type="File" fileName="${logDirectory}/info.txt" />
<target name="fileLogWarn" xsi:type="File" fileName="${logDirectory}/warn.txt" />
</targets>
<rules>
<logger name="*" level="Trace" writeTo="fileLogTrace" />
<logger name="*" level="Debug" writeTo="fileLogDebug" />
<logger name="*" level="Info" writeTo="fileLogInfo" />
<logger name="*" level="Warn" writeTo="fileLogWarn" />
</rules>
</nlog>
Upvotes: 2
Views: 4798
Reputation: 1394
I've finally solved issue.
There were some problems with permissions. Several $ sudo chmod -R 777 .
and several sever restarts do the trick. Everything is logging now.
Upvotes: 5