Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Basedir's parent directory - NLog configuration

Tags:

c#

.net

nlog

I'm using NLog in a multi-project solution. I set the filename property of the config file to "${basedir}/logs/logFile.log" and the problem is: the logs directory is being created in each project's main directory, so each project has its own set of logs. What I'd like to have is a single log directory for the whole solution, so basically it means setting the filename to basedir's parent directory.
How exactly can I do it? "../${basedir}/logs/logFile.log" doesn't seem to work, the logs are still saved to the same directory.

like image 355
Andrew Cyrul Avatar asked May 14 '15 09:05

Andrew Cyrul


1 Answers

I had a similar situation. I needed the /logs/ directory to be a sibling of the actual directory of my project. I found that this works for me with:

fileName="${basedir}/../logs/logFile.log"

I'm using NLog 2.1.0

like image 82
Brian Merrell Avatar answered Oct 27 '22 11:10

Brian Merrell