Why I cannot use ${basedir} nlog.config in my production server? If I use fileName=\"${basedir}/logs/${shortdate}.log\"
, nlog does not log the message info, but
This issue is related to file permission. Short story: the user that the web application is running as does not have permission to write the log files.
Depending on the version of .NET and the version of IIS, there are a variety of users that it could be.
For IIS 6, I would say that the web application is running as the NETWORK SERVICE
account.
Therefore, you will need to grant this user permission to write/modify the logs
folder (which I presume is a sub-folder of the web root). If you want the logs
folder to be created automatically by NLog, you'll need to grant these permissions to the web root instead.