That is possible in one way.
Whatever you put as "initializeData" goes to the constructor of the custom trace listener. So if you have something like this
public class DebugListener :TraceListener
{
string inputFilename = null;
public string LogFileName;
public DebugListener (string filename)
{
inputFilename = filename;
Init();
}
private void Init()
{
LogFileName = inputFilename
.Replace("@date",DateTime.UtcNow.ToString("yyyyMM"));
}
}
and the config
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="dbgListener"
type="MyLogger.DebugListener,MyLogger"
initializeData="MyLog@date.txt"/>
</listeners>
</trace>
</system.diagnostics>
Then you will get the filename as something as MyLog20173.txt
Although remember the constructor will only be called once and you have to restart the app to create a new log but you can always handle that logic in your code like this one which creates a new log file every month
//get new log file name every month
string newFileName = $"log_{DateTime.UtcNow.ToString("yyyyMM")}.txt";
//get new log file name every day
string newFileName = $"log_{DateTime.UtcNow.ToString("yyyyMMdd")}.txt";