You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a large number of issues filed against this project regarding how to correctly perform logging in Azure function - in particular, the fact that your function's method is provided an already-instantiated ILogger object, whereas any DI-injected loggers have to be of type ILogger<T>, which is somewhat confusing.
Furthermore, there is the additional issue whereby logs are filtered by default: #4345
It also appears that there is no need to call IFunctionsHostBuilder.Service.AddLogging() if using Startup.cs, but again this doesn't seem to be called out anywhere in particular.
@brettsam can you comment? Should this be moved to docs?
As a side note, I'm really considering just supporting ILogger as an injected service with a pre-defined category as it seems to be a common source of confusion.
For discoverability, I've been linking all of these to this comment: #2720 (comment)
We definitely need a deeper logging sample, for example you can call AddLogging() and wire up new providers. A good example using some external provider would go a long way.
If we can decide on a category for the ILogger, I now think we should just make it work. People may get confused why this doesn't work in other .NET Core apps, but at least it'd work for Functions.
There are a large number of issues filed against this project regarding how to correctly perform logging in Azure function - in particular, the fact that your function's method is provided an already-instantiated
ILogger
object, whereas any DI-injected loggers have to be of typeILogger<T>
, which is somewhat confusing.Furthermore, there is the additional issue whereby logs are filtered by default: #4345
It also appears that there is no need to call
IFunctionsHostBuilder.Service.AddLogging()
if usingStartup.cs
, but again this doesn't seem to be called out anywhere in particular.These caveats should be documented here, preferably with a link to the .NET Core fundamentals of logging for reference.
The text was updated successfully, but these errors were encountered: