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

Accessing TelemetryClient and ILogger in FunctionsStartup #4681

Closed
LarsKemmann opened this issue Jul 17, 2019 · 2 comments
Closed

Accessing TelemetryClient and ILogger in FunctionsStartup #4681

LarsKemmann opened this issue Jul 17, 2019 · 2 comments

Comments

@LarsKemmann
Copy link

LarsKemmann commented Jul 17, 2019

Is your question related to a specific version? If so, please specify:

Microsoft.NET.Sdk.Functions 1.0.29
Microsoft.ApplicationInsights 2.10.0

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

C#

Question

I need to get access to a TelemetryClient instance in my FunctionsStartup class. How do I do that? I tried serviceProvider.GetService<TelemetryConfiguration>() but I just get null.
Also, I need to get access to an ILogger instance in the same FunctionsStartup class that's configured to log to Application Insights. Help?

Possibly similar/related question: #2473

@LarsKemmann LarsKemmann changed the title Accessing TelemetryClient in FunctionsStartup Accessing TelemetryClient and ILogger in FunctionsStartup Jul 17, 2019
@LarsKemmann
Copy link
Author

So, this may be more appropriately addressed in this issue.

@LarsKemmann
Copy link
Author

Closing as the linked issue in the azure-functions-dotnet-extensions repo is where this needs to be addressed. (If anyone from the Functions team could respond to some of the open issues there it would be appreciated!)

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

No branches or pull requests

1 participant