I have an ASP .NET based application that uses Serilog for logging and I want to test it by writing my logs to files. I am using Serilog and Serilog.Sinks.File So far, the code looks like this:
_perfLogger = new LoggerConfiguration()
.WriteTo.File("C:\\Users\\andav\\Desktop\\NewTest\\logger\\perf.txt")
.CreateLogger();
_perfLogger.Write(LogEventLevel.Information, "{@LogDetail}", infoToLog);
But all my files are empty or are not created and I am not getting any errors.
Am I doing something wrong?
Thank you.
I didn`t know that .Net is not allowed to write in any other folder except App_Data. This was the problem and I managed to fix it.