quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.8k stars 2.68k forks source link

azure-functions-http extension: logs not found on LogStream in Azure UI #21739

Open mederel opened 2 years ago

mederel commented 2 years ago

Describe the bug

Quarkus logs aren't sent to the Azure Function log stream, meaning you do not have access to the logs if deployed in Azure.

Expected behavior

See the logs of Quarkus and the application in LogStream.

Actual behavior

No logs in LogStream of the Azure FunctionApp in portal.azure.com.

How to Reproduce?

Output of uname -a or ver

Ubuntu 20.04

Output of java -version

11.0.11

GraalVM version (if different from Java)

21.3.0

Quarkus version or git rev

56d9b6d55873a5e5a6d4f9db146f2c2d93495b4b (master)

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) Maven home: /home/edeweerd/bin/apache-maven-3.8.3 Java version: 11.0.11, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.11.0-40-generic", arch: "amd64", family: "unix"

Additional information

No response

mederel commented 2 years ago

While working on the source in the PR, and its review about thread local instances of Logger, I ran into a more grave problem of the whole Azure Functions java library, namely that it gives a new instance of logger for each request, but then expects you to use static for everything you want to keep in between function calls. For instance caches, pool of connections, db connections, etc... But all we have to get our logs in the Azure Functions is this request-scoped logger instance, which we have to pass along to all those static instances. This needs some reflection...

moffatn4 commented 2 years ago

Fyi, Application Insights offer a Java agent (public preview) to capture logs:

https://learn.microsoft.com/en-us/azure/azure-monitor/app/monitor-functions

quarkus-bot[bot] commented 2 years ago

/cc @matejvasek, @patriot1burke