Logging with NLOG.config in seperate file

Tags: #<Tag:0x00007f0660e37728> #<Tag:0x00007f0660e37660>

I am trying to seperate my log files with NLog.

<target name="logfile" xsi:type="File" fileName="c:\tmp\log\app.${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}">
    </target>
    <target name="hangfirelog" xsi:type="File" fileName="c:\tmp\log\HangFire.${shortdate}.log" layout="${longdate} ${uppercase:${level}} ${message}">
    </target>

<logger name="HangFire.*" minlevel="Debug" writeTo="hangfirelog" />
<logger name="MyAppNamespace.*" minlevel="Debug" writeTo="logfile" />

Hangfire does not log into the “hangfirelog” File
If I log everything in one file, everything works fine.

<logger name="*" minlevel="Debug" writeTo="logfile" />

I guess Hangfire didn’t read the “rules” Section in the NLog.config File

My own mistake. Writing Hangfire with small f ist better :smile:

<logger name=“Hangfire.*” …>

solved the Problem.