You can use built-in logger instead creating logger yourself: https://learn.microsoft.com/en-us/dotnet/core/extensions/logging?tabs=command-line