ASPNET Core 2.0 with latest Nlog.
All config files load correctly.
My config file is simple, I just want it to log every thing.
<?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="C:\wwwLogs\nlog.log">
<extensions>
<add assembly="NLog.Web.AspNetCore"/>
</extensions>
<targets>
<target xsi:type="File" name="allfile" fileName="C:\wwwLogs\${shortdate}.log"
maxArchiveFiles="90"
archiveNumbering="DateAndSequence"
archiveAboveSize="250000"
archiveFileName="archive/log.{#######}.log"
archiveEvery="Day"
concurrentWrites="true"
layout="${longdate}|${logger}|${uppercase:${level}}|${message} ${exception}" />
</targets>
<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="Trace" writeTo="allfile" />
</rules>
</nlog>
I can see it in the trace log for nlog it is setting all levels to the correct output.
2017-11-01 14:21:26.3017 Trace Opening C:\wwwLogs\2017-11-01.log with allowFileSharedWriting=False
2017-11-01 14:21:28.5859 Debug Targets for TimeSlotApprovalService by level:
2017-11-01 14:21:28.5859 Debug Trace => allfile
2017-11-01 14:21:28.5859 Debug Debug => allfile
2017-11-01 14:21:28.5859 Debug Info => allfile
2017-11-01 14:21:28.5859 Debug Warn => allfile
2017-11-01 14:21:28.5859 Debug Error => allfile
2017-11-01 14:21:28.5859 Debug Fatal => allfile
In my application when I call this
_logger.LogDebug(JsonConvert.SerializeObject(resultList, Formatting.Indented));
_logger.LogError(JsonConvert.SerializeObject(resultList, Formatting.Indented));
_logger.LogCritical(JsonConvert.SerializeObject(resultList, Formatting.Indented));
_logger.LogWarning(JsonConvert.SerializeObject(resultList, Formatting.Indented));
_logger.LogTrace(JsonConvert.SerializeObject(rankedTimeSlots, Formatting.Indented));
Then the log file only logs these
2017-11-01 14:44:48.2570|TimeSlotApprovalService|**ERROR**|[json...
2017-11-01 14:44:48.2570|TimeSlotApprovalService|**FATAL**|[json...
2017-11-01 14:44:48.2570|TimeSlotApprovalService|**WARN**|[json...
Where are the rest?? Trace and Debug?? Info?