DocumentationDiscussions
DocumentationDiscussions

Discussions

Ask a Question
Back to All

Entries in seq do not appear unless certain code is executed.

So I have recently plugged serilog into seq and I have been trying to get this working but have encountered a strange problem.

I have injected an instance of ILogger into my code and this works fine for Console logs, but the seq logs appear to be blocked until other parts of the code have executed.

For example, with the following 5 lines of code;

  1. _ logger.LogInformation($"Processing user {user}",user.Email);
  2. _logger.LogError($"Processing user {user}", user.Email)
  3. _notifications.Clear();
  4. var domains = await _domainRepository.ListAsync(new ActiveDomainsForUser(user.Id, true));
    5 foreach (var domain in domains)

If I put a breakpoint on line 3, the seq logs do not arrive.
If I then step through to line 4, the seq logs do not arrive.
If I then step through to line 5, the seq logs then arrive.

It is as if there is some blocking going on that is released after the async repository call (which does not have an ILogger injected) and does nothing funky at all.

I can reproduce this each and every time and regardless of how long I pause debugging, the logs always arrive very shortly after line 5 is executed.

Suggestions would be appreciated.