Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more explicit documentation around logging #4701

Closed
IanKemp opened this issue Jul 23, 2019 · 3 comments
Closed

Add more explicit documentation around logging #4701

IanKemp opened this issue Jul 23, 2019 · 3 comments
Assignees

Comments

@IanKemp
Copy link

IanKemp commented Jul 23, 2019

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.

These caveats should be documented here, preferably with a link to the .NET Core fundamentals of logging for reference.

@fabiocav
Copy link
Member

@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.

@brettsam
Copy link
Member

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.

@brettsam brettsam added this to the Triaged milestone Nov 13, 2019
@jeffhollan
Copy link

Just opened a docs PR that includes showing how to use ILogger<T> or ILoggerFactory and modifying the host.json to opt-into those new filters.

@ghost ghost locked as resolved and limited conversation to collaborators Apr 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants