Serilog not logging in rolling file when deployed to IIS?

4k Views Asked by At
 public Startup(IHostingEnvironment env)
        {
            Log.Logger = new LoggerConfiguration()
            .MinimumLevel
            .Error()
            .WriteTo.RollingFile("logs\\log-{Date}.txt", LogEventLevel.Information) // Uncomment if logging required on text file
            .CreateLogger();
...........

With above configuration I can see any errors I log in application in logs folder, but only when I run it locally.

However when I deploy the same website on IIS, even logs directory exist in website root level, it doesn't even create file or write any logs to any text file.

Note: logs is the same folder which I have configured in web.config for stderror output and the file is created for stdoutput though:

web.config:

<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />

So it cannot be write permissions issue as stdout file is created, but serilog fails to crate file/log errors for some reason.

0

There are 0 best solutions below