Azure / Azure/azure-functions-host

Allow Java loggers outputs to be displayed in the function instance console log

Open
#10,485 1 comment 0 reactions 0 assignees View on GitHub
Logging and Metrics needs-investigation
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

#### What problem would the feature you're requesting solve? Please describe.
I have created a Java function app using the VSCode template for a Queue Based Trigger and we use Logback to handle all of our logging. I followed [this doc](https://learn.microsoft.com/en-us/azure/developer/java/sdk/logging-logback) to set this up. This seems to log things to the console as expected when running locally; however, when I push this to an Azure Function these logs don't show up in the Function Instance log. The do show up in the Function App Host `Log Stream` but there is a lot of noise there they I have to filter through. I have enabled distributed tracing so it seems to tie the invocationId to each log in the `traces` table in app insights, but they don't seem to be showing up in the log stream.

#### Describe the solution you'd like
I'd like to be able to see these logs in the Function Instance `Log Stream` so I can get a real-time view of what is going on with my function instance.

#### Describe alternatives you've considered
I could get these logs from the function host log, but there is too much noise to filter out. I can also get these logs from the traces table in application insights, but I have to wait on the delay before they get out there.

#### Additional context
I've setup an example where I've used the default logger and my logback logger to see if I could tell the difference between the logs. From an App Insight perspective these appear the same having all of the properties I would expect. When I do a network trace and watch the queryLogs api calls I can see the log in the payload, but it is missing the Content.OperationName and in the Content.Properties array isn't missing the InvocationId key.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Java Queue trigger with the VSCode template and compare the Function Instance Log Stream with the Function App Host Log Stream. Check how the host associates incoming logs with Content.OperationName and the InvocationId property; done means Logback output appears in the instance stream with the invocation context while retaining the existing Application Insights behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, java
Domain
backend, observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.