Based on parent directory - NLog config
I am using NLog in a multi-project solution. I set the filename
config file property to "${basedir}/logs/logFile.log"
, and the problem is this: a log directory is created in each main project directory, so each project has its own set of logs. I would like to have one log directory for the entire solution, so this basically means that filename
for the parent directory. How can i do this? "../${basedir}/logs/logFile.log"
doesn't seem to work, the logs are saved in the same directory.
source to share
You can use for example ${specialfolder:folder=LocalApplicationData}/logs/logFile.log
. This will create a log%USERPROFILE%\AppData\Local\logs
This solution will also work on an enterprise application, as this folder has all the user rights required for the application process to write logs.
source to share