How to create new log file for each application run
NLog's FileTarget support now a Property archiveOldFileOnStartup (NLog-3-2-0 Release).
archiveOldFileOnStartup="true"
There may be some issues with that, but if only a single instance of the App is running at the same time, it should have the desired behavior.
I came across this problem myself, and it took me a long time to figure it out. Most of the answers I've found only have part of the solution and don't explain how/why it works... which makes it hard to adapt if you have a slightly different use case.
Example:
<target name="log"
xsi:type="File"
fileName="${basedir}/logs/log.${longdate:cached=true}.log"
layout="${message}"
archiveFileName="${basedir}/logs/archives/log.${shortdate}.{#}.log"
archiveAboveSize="5242880"
archiveEvery="Day"
archiveNumbering = "Rolling"
maxArchiveFiles="20"
/>
Explanation
You have to use both the Cached Layout Renderer and the longdate variable. To understand why this works, you need to understand how they they work, and how they interact.
longdate:
fileName="${basedir}/logs/log.${longdate}.log"
Using the longdate variable in your log name will pretty much guarantee a new log file on every execution... except it creates a new log file every millisecond even during a single execution which is probably not desirable except in the most rare of circumstances.
Cached Layout Renderer:
fileName="${basedir}/logs/log.${shortdate:cached=true}.log"
Cached layout renderer will cache the variable on the first log call, and then always use that value for subsequent entries... but the cache only persists until the execution completes. Using shortdate, or any other variable that isn't guaranteed to changeon each execution, won't work. It will find a log file with the same filename it wants to use, and it'll just append (or delete if you have that set). This is not what we want.
Combined:
fileName="${basedir}/logs/log.${longdate:cached=true}.log"
This works because it takes the millisecond timestamp of the first log per execution, and then caches it, and always uses that logfile until the execution terminates (clearing the cache). Next time you run it (unless it's the same millisecond... unlikely!) you'll get a new value cached, and a new log file (but only one!).
See https://github.com/NLog/NLog/blob/master/tests/NLog.UnitTests/LayoutRenderers/Wrappers/CachedTests.cs for an example of how to use the Cached layout renderer.
Basically it can be used like this:
${cached:${variable}:cached=true}