Title: Does multiple calls to LoggerFactory.CreateLogger<...> create a new file?
Tags: asp.net
Question: In each asp.net core page, I make the following call:

```new MyClass(LoggerFactory.CreateLogger<...&gt;);
```

I am wondering whether that is the correct way or should I keep a singleton logger to be passed around.


Here is the accepted answer: Yes. This is a correct usage. 

The instance of the Logger that is created is independent of the output Sinks (file/console/debug/etc). Whatever sinks you have configured in your Startup will be used by the Logger instances that are created.

For Reference: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:09/05/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<asp.net>', 'Title': 'Does multiple calls to LoggerFactory.CreateLogger<...> create a new file?', 'ViewCount': 107, 'id': 52194226, 'user_AboutMe': None, 'user_AccountId': None, 'user_DisplayName': None, 'user_Reputation': None, 'user_Views': None, 'user_id': None}}