Rollingfile relative path not working in ASP.NET MVC + IIS Express
See original GitHub issueI’m using the serilog on first application, it’s ASP.NET MVC app + IIS Express using serilog, configured with following AppSetting configs,
<add key="serilog:minimum-level" value="Verbose" />
<add key="serilog:write-to:RollingFile.pathFormat" value="logs\log-{Date}.txt" />
<add key="serilog:write-to:RollingFile.retainedFileCountLimit" value="3" />
the application creates log file at C:\Program Files (x86)\IIS Express\logs\
Is there a way to to use the relative path. It works if i use a full path!
I’m using log4net in other MVC apps, it resolves to relative path, though!
Issue Analytics
- State:
- Created 8 years ago
- Comments:21 (4 by maintainers)
Top Results From Across the Web
Why IIS doesn't handle relative path the same way IIS ...
Indeed, IIS Express seem to run the app from the root while a web deploy on IIS will, by defaut, create a application...
Read more >IIS Express on VS2022 not loading CSS,images and other ...
IIS Express on VS2022 not loading CSS,images and other static content This is happening when I'm trying to access a ".aspx" page in...
Read more >Setting up Serilog in ASP.NET Core - Detailed Beginner ...
Here I have specified a relative path that will create folder serilogs in the application folder and write to the file AppLogs.log in...
Read more >Log creation and redirection with the ASP.NET Core Module
The following sample aspNetCore element configures stdout logging at the relative path .\log\ . Confirm that the AppPool user identity has ...
Read more >IIS express doesn't show index.cshtml in one folder but in ...
Coding example for the question IIS express doesn't show index.cshtml in one folder but in other it shows-Asp.Net-Mvc.
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
Folks, if anyone has ideas for baking this in more elegantly I’d be interested; for now I think the following in
Global.asax.cs
before configuring the logger:and the following config:
is a pretty good option. @SathishN thanks again for the input on this!
Here is how I did it with an ASP.NET MVC 4/5 application.
Add the following to the web.config file:
Then add the following to the
Application_Start
in Global.asax: