CodeMazeBlog/.NET-Core-Series

Absolute path in nlog.config

kgothatsotlaka opened this issue · 2 comments

Hi, I'd like to know, since in the example you used absolute paths, will this approach not give us a problem during production?

If so, how does one go about using relative paths ?

Thanks

Hello. You have two solutions for this. In a production environment, you will have nlog.config file deployed as well, so you can change absolute locations to the right ones.

Or you can change these absolute paths with relative ones:
<target name="logfile" xsi:type="File" fileName="..\logs\${shortdate}_logfile.txt" layout="${longdate} ${level:uppercase=true} ${message}"/> </targets>

Thank you! I will try using the absolute path method for now