-
Notifications
You must be signed in to change notification settings - Fork 194
logging changes #123
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
Merged
Merged
logging changes #123
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brettsam
commented
Feb 12, 2021
brettsam
commented
Feb 12, 2021
brettsam
commented
Feb 12, 2021
brettsam
commented
Feb 12, 2021
mhoeger
reviewed
Feb 17, 2021
fabiocav
reviewed
Feb 18, 2021
|
||
private static class Log | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider moving this to a partial with <file>.Log.cs
like in the host?(https://github.com/Azure/azure-functions-host/blob/13a43aaa7d7f8441a51233083e692cc584f49143/src/WebJobs.Script.WebHost/Middleware/HostAvailabilityCheckMiddleware.Log.cs)
src/DotNetWorker/Diagnostics/GrpcFunctionsHostLoggerProvider.cs
Outdated
Show resolved
Hide resolved
852646b
to
9dde244
Compare
fabiocav
approved these changes
Feb 18, 2021
9dde244
to
8ff0fd4
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A couple of notes about the approach here. I think that we should follow a similar pattern to gRPC: https://docs.microsoft.com/en-us/aspnet/core/grpc/diagnostics?view=aspnetcore-5.0. There's a mix of logging,
DiagnosticSource
, and metrics where necessary. This only gets us running with the logging part and the others can follow up later.Also see this great comment about logging abstractions in .NET.: aspnet/Logging#332 (comment). You can check out the entire issue -- lots of good stuff there.
Notably:
ILogger
isn't something typically injected by DI (.NET only supportsILogger<T>
. It meant that in WebJobs/Functions we had to come up with a logger category that we passed to you -- which led to a bunch of other confusing issues for customers. Now you can access a logger by:ILogger<T>
into constructorGetLogger
extension method on context, which pulls the logger from theInstanceServices
for that execution.AsyncLocal
to flag logs that are coming from us, so we know they are System logs. Note. I don't currently like this. I've commented in the PR and I'm working on a change to make this a more complete solution. Update: I've now taken care of this with the newWorkerMessage.Define
. See note below