I’ve enabled NLog internal logging to figure out an issue where our logs suddenly stop sometimes.
Might be unrelated to the issue I’m trying to figure out but I’ve gotten this Exception for one of the targets (FileTarget logging with ConcurrentWrites = true, wrapped by AsyncTargetWrapper).
This is a file where a couple of running applications should be able to write to.
I’m currently running NLog version 5.2.8 on all applications
The error is:
2024-07-22 12:35:33.2512 Debug EventLogTarget([unnamed]): Refresh EventLog Source Company.WCF.Client.Console - Client and Log Application
2024-07-22 12:35:33.2512 Debug FileTarget([unnamed]): Preparing for new file: 'C:ProgramDataCompanyLogsAllExceptions.txt'
2024-07-22 12:35:33.2512 Debug FileTarget([unnamed]): Creating file appender: 'C:ProgramDataCompanyLogsAllExceptions.txt'
2024-07-22 12:35:33.2512 Warn FileTarget([unnamed]): Failed to create file appender: C:ProgramDataCompanyLogsAllExceptions.txt Exception: System.UnauthorizedAccessException: Access to the path 'C:ProgramDataCompanyLogsAllExceptions.txt' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileSystemRights rights, FileShare share, Int32 bufferSize, FileOptions options)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender.CreateAppendOnlyFile(String fileName)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender..ctor(String fileName, ICreateFileParameters parameters)
at NLog.Internal.FileAppenders.WindowsMultiProcessFileAppender.Factory.NLog.Internal.FileAppenders.IFileAppenderFactory.Open(String fileName, ICreateFileParameters parameters)
at NLog.Internal.FileAppenders.FileAppenderCache.CreateAppender(String fileName, Int32 freeSpot)
Could I get an explanation on why this could be triggered? This seems to have happened while the applications were running on my development machine, without any intervention at that timestamp