Im using Nlog for my project.
And for some reason I don’t get any logs in the project folder.
this is my 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="Info"
internalLogFile="${basedir}internal-nlog.txt">
<!-- enable asp.net core layout renderers -->
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets>
<target xsi:type="AsyncWrapper" name="AllAsyncWrapper" queueLimit="10000" batchSize="1000">
<target xsi:type="File"
name="allfile"
fileName="Loggerlog.log"
archiveFileName="Loggerarchivesnlog-all-${shortdate}.archive-{#}.zip"
archiveEvery="Day"
maxArchiveDays="7"
archiveNumbering="DateAndSequence"
enableArchiveFileCompression="True"
archiveAboveSize="10000000"
layout="${longdate}|${aspnet-traceidentifier}|${uppercase:${level}}|${threadid}|${logger}|${message} ${exception:format=ToString}|${aspnet-request-method}|${aspnet-request-url}|${aspnet-mvc-action}|${aspnet-request-posted-body}" />
</target>
</targets>
<!-- rules to map from logger name to target -->
<rules>
<logger name="*" minlevel="Info" writeTo="AllAsyncWrapper" />
</rules>
</nlog>
And here i call the logger:
Logger.Info(DateTime.Now + " - AutoCharge is beginning...");
I’m just saying that in my Second project everything works properly with the same code, I think maybe it’s related to the fact that from my first project I use the code in the second project (reference) and the call to the logger is in the second project, even though there are no loggers in the second project’s folder either.
1