NetEscapades.Extensions.Logging icon indicating copy to clipboard operation
NetEscapades.Extensions.Logging copied to clipboard

No logfile written when LogDirectory is in an absolute path

Open ssteiner opened this issue 5 years ago • 3 comments

Is there any special syntax to be used for absolute paths? Things work just fine when I provide a relative path in options.LogDirectory, but when I use an absolute one (in my example:

options.LogDirectory = @"c:\temp\";

no logfile is being written.

ssteiner avatar Jan 08 '20 13:01 ssteiner

Hi, that works fine - it's likely due to the folder not being somewhere ASP.NET Core has write access to. Try using an absolute path somewhere inside your project folder for example

andrewlock avatar Jan 08 '20 17:01 andrewlock

Using an absolute path that's inside the project folder does work indeed. Why would ASP.NET Core not have acces to other paths though? Our traditional ASP.NET MVC projects all write to c:\temp which works just fine.

When I debug the app without IIS, it also works. But where is the permission system for the ASP.NET core runtime managed? Why has it less access then the owner of the IIS express task?

ssteiner avatar Jan 08 '20 18:01 ssteiner

It's a good question, and I'm not sure of the answer.

But where is the permission system for the ASP.NET core runtime managed?

That depends how you're running your app - if you're using IIS then it runs under the app pool user. Otherwise it's whichever user starts the dotnet process

andrewlock avatar Jan 08 '20 21:01 andrewlock