Serilog not logging in rolling file when deployed to IIS?
See original GitHub issue 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 screated, but serilog fails to crate file for some reason.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Enable file logging on IIS for serilog - net core
2 Answers. Serilog works perfectly on local. For IIS the log file folder need IIS User Permission. Now give folder permission on deployed...
Read more >Serilog configured in .Net Core web api not showing up ...
Serilog configured in .Net Core web api not showing up logs under configured path after deploying to IIS in Azure VM. · Open...
Read more >Logging with Serilog in ASP.NET Core Web API
For this tutorial, we are mainly interesting in File sinks since we will be dumping our logs within rolling files.
Read more >Setting up Serilog in ASP.NET Core - Detailed Beginner ...
This article covers the implementation of Serilog in ASP.NET Core which provides structured logging that is easier to be read by programs.
Read more >.NET Logging Basics - The Ultimate Guide To Logging - Loggly
Serilog is an open-source library like the IloggerFactory and can write logs to many different destinations such as files, a console, an Elasticsearch...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Utter nonsense. Going by your logic if a system fails no one will ever be able to fix a fault because there is no diagnostic information due to an irrational fear that the hard drive might fill up (which I might add is easily rectified by employing a due-diligent Operations Staff).
I guess someone better tell people not to use:
I know that on our production environments, the IIS application pool accounts do not have any write permissions anywhere … (it is a choice from the Ops team)
FWIW I believe it is general considered “bad practice” to log to files on production environments, because :