{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Logging/issues/449","repository_url":"https://api.github.com/repos/aspnet/Logging","labels_url":"https://api.github.com/repos/aspnet/Logging/issues/449/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Logging/issues/449/comments","events_url":"https://api.github.com/repos/aspnet/Logging/issues/449/events","html_url":"https://github.com/aspnet/Logging/issues/449","id":158974033,"number":449,"title":"How to use FilterLoggerFactory as default ILoggerFactory","user":{"login":"epignosisx","id":697377,"avatar_url":"https://avatars.githubusercontent.com/u/697377?v=3","gravatar_id":"","url":"https://api.github.com/users/epignosisx","html_url":"https://github.com/epignosisx","followers_url":"https://api.github.com/users/epignosisx/followers","following_url":"https://api.github.com/users/epignosisx/following{/other_user}","gists_url":"https://api.github.com/users/epignosisx/gists{/gist_id}","starred_url":"https://api.github.com/users/epignosisx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epignosisx/subscriptions","organizations_url":"https://api.github.com/users/epignosisx/orgs","repos_url":"https://api.github.com/users/epignosisx/repos","events_url":"https://api.github.com/users/epignosisx/events{/privacy}","received_events_url":"https://api.github.com/users/epignosisx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-07T17:00:05Z","updated_at":"2016-06-09T15:03:57Z","closed_at":null,"body":"I would like to use [FilterLoggerFactory](https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Filter/Internal/FilterLoggerFactory.cs) as the default **ILoggerFactory**. I see there is a [WithFilter](https://github.com/aspnet/Logging/blob/dev/src/Microsoft.Extensions.Logging.Filter/FilterLoggerFactoryExtensions.cs) extension method that returns the **FilterLoggerFactory** but it will not affect the ILoggerFactory registered with DI.\r\n\r\nWhere is the right place to configure FilterLoggerFactory as the default? I'm thinking it would be with the \r\n[WebHostBuilder](https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/WebHostBuilder.cs)\r\n\r\n```c#\r\npublic static void Main(string[] args)\r\n{\r\n    var host = new WebHostBuilder()\r\n        .UseKestrel()\r\n        .UseContentRoot(Directory.GetCurrentDirectory())\r\n        .UseLoggerFactory(new FilterLoggerFactory(new LoggerFactory(), new FilterLoggerSettings()))\r\n        .UseStartup<Startup>()\r\n        .Build();\r\n\r\n    host.Run();\r\n}\r\n```\r\n\r\nAlso, what's the guidance on directly accessing APIs in that have \"Internal\" in the namespace? In this case **Microsoft.Extensions.Logging.Filter.Internal.FilterLoggerFactory**."},"comment":{"url":"https://api.github.com/repos/aspnet/Logging/issues/comments/224923841","html_url":"https://github.com/aspnet/Logging/issues/449#issuecomment-224923841","issue_url":"https://api.github.com/repos/aspnet/Logging/issues/449","id":224923841,"user":{"login":"epignosisx","id":697377,"avatar_url":"https://avatars.githubusercontent.com/u/697377?v=3","gravatar_id":"","url":"https://api.github.com/users/epignosisx","html_url":"https://github.com/epignosisx","followers_url":"https://api.github.com/users/epignosisx/followers","following_url":"https://api.github.com/users/epignosisx/following{/other_user}","gists_url":"https://api.github.com/users/epignosisx/gists{/gist_id}","starred_url":"https://api.github.com/users/epignosisx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/epignosisx/subscriptions","organizations_url":"https://api.github.com/users/epignosisx/orgs","repos_url":"https://api.github.com/users/epignosisx/repos","events_url":"https://api.github.com/users/epignosisx/events{/privacy}","received_events_url":"https://api.github.com/users/epignosisx/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T15:03:57Z","updated_at":"2016-06-09T15:03:57Z","body":"Thanks @SimonTouchtech. I really like the:\r\n\r\n```\r\n.UseLoggerFactory(new LoggerFactory().WithFilter(new FilterLoggerSettings()))\r\n```\r\n\r\nI think the suggestion:\r\n```\r\nservices.AddSingleton(new LoggerFactory().WithFilter(new FilterLoggerSettings()));\r\n```\r\n\r\nwill not be picked up by the web host since it already created its logger so the filtering will not take effect there.\r\n\r\nI'm going to keep the issue open to see if I can get some guidance on the usage of classes in the \"Internal\" namespace."}}
{"actor":{"display_login":"epignosisx"}}