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

Function startup logs #1070

Open
ffarinha-msft opened this issue Sep 13, 2023 · 4 comments
Open

Function startup logs #1070

ffarinha-msft opened this issue Sep 13, 2023 · 4 comments

Comments

@ffarinha-msft
Copy link

ffarinha-msft commented Sep 13, 2023

Is your feature request related to a problem? Please describe.

On Azure Function App, the first time a function runs there will be some startup logs coming from "org.springframework.cloud.function.utils.FunctionClassUtils" to the STDOUT which will be captured by the Application Insights Agent running on the same (when setting APPLICATIONINSIGHTS_ENABLE_AGENT is turned on)

Example:
image

Describe the solution you'd like
I would like to have a flag that allowed me to turn of information level logs from org.springframework.cloud.function.utils.FunctionClassUtils. If there is such a flag I haven't been able to find it.

Describe alternatives you've considered
I was able to turn of information level logs from org.springframework.boot, by adding the following properties to my application.properties file:

spring.main.banner-mode=off
logging.level.org.springframework=WARN
spring.main.log-startup-info=OFF

Example of the log I turned off
image

But I tried adding all the below properties to my application.properties file without any luck:

logging.level.org.springframework.cloud.config=WARN
logging.level.org.springframework.cloud.function=WARN
logging.level.org.springframework.cloud=WARN
logging.level.org.springframework.cloud.function.utils.FunctionClassUtils=WARN
logging.level.org.springframework.cloud.function.utils=WARN
logging.level.root=OFF

I also tried to use the preview feature of Application Insights to filter the logs but I found that it will also turn off my custom logging https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-sampling-overrides#how-it-works

@olegz olegz added this to the 4.1 milestone Sep 21, 2023
@tzolov
Copy link
Contributor

tzolov commented Sep 25, 2023

Hi @ffarinha-msft, could you please provide a detailed instructions how to configure and see the above traces/logs in the azure/portal?

@olegz olegz removed this from the 4.1 milestone Sep 26, 2023
@ffarinha-msft
Copy link
Author

ffarinha-msft commented Sep 28, 2023

Hi @tzolov

Thank you for coming back to me.

The issue described can be reproduce with a simple hello world spring function has this examples:

https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/getting-started-with-spring-cloud-function-in-azure

https://github.com/Azure-Samples/hello-spring-function-azure

Once you have your simple hello world spring function application you deploy the code to a Linux Azure Function App (I did not test on Windows).

Then you trigger the function execution and you will notice that the first invocation will have the initialization logs I mentioned:
image

image

image

If you want to view more details about the logs namely the logger where they are coming from (as I showed on the original post) you can access directly the Application Insights on the Azure Portal, got to "Transaction Search" and search for "Searching for start class" you will find records like this:
image

You then double click on one of those results and a blade like below will open where you can then see more details about each of the logs:

image

Important:

As mentioned before to so those logs you need to have the App Insights Agent turned on which can be done by navigating to the function app and then to App Insights blade and activate the "Recommended" log option
image

@tzolov
Copy link
Contributor

tzolov commented Oct 30, 2023

@ffarinha-msft ,

Thank you for your update, but unfortunately I'm still not able to reach the portal pages you've shared above.
As you can see below i have the APPLICATIONINSIGHTS_ENABLE_AGENT set to true the App Insights seems enabled but i can not see the Developer/Monitor menu options.
I'm not Azure portal savvy. Do i need a special plan?

Screenshot 2023-10-30 at 15 06 05_anonymized
Screenshot 2023-10-30 at 15 03 05_anonymized
Screenshot 2023-10-30 at 15 04 26_anonymized

@ffarinha-msft
Copy link
Author

Hi @tzolov

Thank you for coming back.

It looks like you were almost there (you don't need any special plan) :)

You already accessed Application Insights resource from the screen shot you shared. Once there you need to click on "Tansaction Search":

image

Then you search for the log message we are after.
Note the log only happens after on the first function execution so you might need to restart the function app and then trigger the function again. Also important to note that the logs on App Insights my take a couple of minutes to show up.

image

You then double click on one of those results and a blade like below will open where you can then see more details about each of the logs:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants