Recently, when NLog was deployed on the server to write logs, the local test was ok, and it can be written to any way. However, after being published to the server, it can only be written occasionally, or there may be some unexplained missing log writing. Although the request to write log is clearly executed.
Problem: later, it was suspected that it might be the permission problem of the log file. It may be that the user identity at the time of writing the program does not have the permission to create and update the file.
Solution: add a full control permission for everyoney user to the log file directory. Including: read, write permissions, etc. Refer to the following figure for details: