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.
You may be able to if you add read/write permission for IIS_IUSRS on the directory.
I usually put the log directory in the same directory as my IIS app and do the following:
You need local admin permissions:
If it cannot find it then click on locations
...
Logging "should" work
If it is a directory outside of inetpub, I am not sure but worth a try.
-Gina
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With