I am using NLog in my Asp.net Core Application, but NLog is not able to write in file, i have all ready change permission of file,but still facing proble. file gets created,on first time but unable to write log in that file.
Here is my nlog.config file code below:
<?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:\git\damienbod\AspNetCoreNlog\Logs\internal-nlog.txt">
<targets>
<target xsi:type="File" name="allfile" fileName="D:\nlog-all.txt"
layout="${longdate}|${event-properties:item=EventId.Id}|${logger}|${uppercase:${level}}|${message} ${exception}"
keepFileOpen="false"/>
<target xsi:type="EventLog"
name="String"
layout="Layout"
machineName="String"
source="Layout"
category="Layout"
eventId="Layout"
log="String"
maxMessageLength="Integer" />
</targets>
<rules>
<!--All logs, including from Microsoft-->
<logger name="*" minlevel="*Info*" maxLevel="*Deubg*" writeTo="allfile" />
</rules>
</nlog>
And here is code of my controller
NLog.Logger _Logger= LogManager.GetCurrentClassLogger();
_Logger.Info("Hello i m executing");