Closed jeff-simeon closed 2 years ago
Is this your complete configuration? The line b.AddConfiguration(configuration.GetSection("Logging"));
suggests that you probably have some JSON configuration too. Could you post the relevant part (the "Logging" section) of this configuration? Besides that, what is the library version you use? Which OS does your application run on?
Without these pieces of information I can't really start to look into this. However, the fact that LogFileAccessMode.OpenTemporarily
solves the problem suggests that there are multiple log queues competing for the same log file. This can happen in a few ways. I've already had an issue where there was some DI configuration issue and two instances of FileLoggerProvider
was created with the same configuration. Isn't it possible that you have something similar going on in your app?
You called it. Multiple containers.
Thanks!
I have the following configuration:
The initial set of log entries are flushed to the file right away, however, once the program goes parallel and has many different ILogger instances writing concurrently, no new log entries appear in the output file and by adding:
I can see many events indicating file locking issues
I know that it's not something I'm doing locking the file, because if I add
I don't get any locking exceptions from
FileLoggerContext.Default.DiagnosticEvent
and new log entries are correctly flushed to the output log file.