skip to Main Content

NLog: how to specify log folder at runtime – Asp.net

For an example, i have following code (ASP.NET core 6): Program.cs: //... var config = new NLog.Config.LoggingConfiguration(); var logfile = new NLog.Targets.FileTarget("logfile") { FileName = Path.Combine(AppFolderPath, "log", "${var:myLogName}", "log_${date:format=dd-MM-yyyy}.txt") }; config.AddRule(NLog.LogLevel.Trace, NLog.LogLevel.Fatal, logfile); LogManager.Configuration = config; //... Startup.cs: public void…

VIEW QUESTION
Back To Top
Search