You can read about this in details in this article: https://medium.com/@riturajpokhriyal/advanced-logging-in-net-core-a-comprehensive-guide-for-senior-developers-d1314ec6cab4?sk=c9f92fbb47f93fa8b8bf21c36771ec8c
This is a very comprehensive article.