-
Notifications
You must be signed in to change notification settings - Fork 195
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
Application logs are not emitted directly to Application Insights, but are being relayed through the Function host with host.json taking effect #2935
Comments
We will need to reproduce the issue to understand it fully, but based on your description, it does seem like there is something unexpected happening here. We'll investigate. Just as a note, one other way to check where the logs are coming from is to look at the |
Hi @mattchenderson, Thanks for your response. I appreciate your support. I just checked, and the logs are emitted with So, they're originating from the worker ( But for those to be emitted, I must set also set |
Hi @nlykkei , can you confirm if you see duplicate logs? |
@RohitRanjanMS Sorry, I'm not sure what you want me to do. The code you see in my example:
is only for creating a startup logger, as it wasn't otherwise possible to log errors in Program.cs. This logger is not used in the functions. Isn't Currently, I don't see duplicate logs in Application Insights, they're all emitted by the Application Insights SDK |
Hi @nlykkei , can you share what do you see for |
@RohitRanjanMS Thanks for getting back. How are you progressing on this? Have you created a simple Function app (.NET 9-isolated) to assert the bug? Severity level: Verbose |
Description
I'm configuring my Azure Function app to send logs directly to Application Insights, as documented here:
https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=hostbuilder%2Cwindows#application-insights
This should allow me to configure logging in the application only (e.g. appsettings.json), without host.json having affect on the Application Insights emitted logs.
However, when running the Function app in Azure, debug logs are not sent to Application Insights, unless I modify host.json with
logging.logLevel.Function: "Debug"
. Doesn't this mean that application logs are actually sent over the Function host, i.e.Worker -> Functions host -> Application Insights
instead ofWorker -> Application Insights
?How can I sent application logs directly to Application Insights?
I have the required package references in .csproj:
Program.cs:
Steps to reproduce
Create a Function app and configure it to sent application logs directly to Application Insights as documented here:
Configure the application with a logging filter for a category set to "Debug" and write debug logs with this category. Only logs with "Information" level or above are sent to Application Insights, as this is the default setting for host.json's logging.logLevel.Function setting
The text was updated successfully, but these errors were encountered: