Closed landonzeng closed 1 year ago
But I set the path to d:\projectService\Service\log\Error.log and there is no problem, can't I use a relative path?
Please don't cross post between here and stackoverflow https://stackoverflow.com/questions/75066312/serilog-is-made-as-a-logging-plugin-and-no-log-files-are-generated-in-the-project. I appreciate that it's frustrating that you don't have a solution yet, but if you're going to get an answer, it will be via SO.
Use of issues in this repo should be confined to reproducible actual bugs in Serilog.
What you are experiencing here is the intersection of two issues:
You're better off researching good approaches to that (I have not looked in recent times, so am not sure if there is a good article out there, but the chances there are - may people write services and want to write logs in them) and figuring out a good place to put the logs in the context of your overall app.
Serilog will work just fine once you establish a good place to put the logs and the permissions.
But I set the path to d:\projectService\Service\log\Error.log and there is no problem, can't I use a relative path?
The rules for that are defined by Windows and/or System.IO - Serilog does not bring its own logic (and I don't think it should - Serilog is used in a huge variety of contexts, and anything 'clever' it would do would likely cause problems in those other context)
Upvoted the SO post, hope you have enough info to go on from here :+1:
The Serilog maintainers want you to have a great experience using Serilog.Expressions, and will happily track down and resolve bugs. We all have limited time, though, so please think through all of the factors that might be involved and include as much useful information as possible π.
βΉ If the problem is caused by a sink or other extension package, please track down the correct repository for that package and create the report there: this tracker is for the Serilog.Expressions package only.
Description My project is c#6.0, after deploying it as a windows service, after the project runs, the log file is not generated in the directory, but in the C:\Windows\System32 folder
Reproduction The json configuration is as follows:
Expected behavior
I guess it is because the project is running in windows service, so the running path is under the system32 folder path, so the log relative path configured is c:\windows\system32, I want to generate the log file in the directory where the program is running
Relevant package, tooling and runtime versions C#6.0 Serilog.AspNetCore 6.1.0
Additional context