'How to change log level in Azure Functions

We are working on several Quarkus (2.5.4 at the time of writing) applications that are deployed to Azure Function Apps.

We've noticed that all our logs, regardless of severity in code, show up as info in application insights.

public class ExampleClass {
    private static final Logger logger = LoggerFactory.getLogger(ExampleClass.class);

    public void welcome(@NotNull String name) {
        logger.trace("TRACE hello to {}", name);
        logger.debug("DEBUG hello to {}", name);
        logger.info("INFO hello to {}", name);
        logger.warn("WARN hello to {}", name);
        logger.error("ERROR hello to {}", name);
    }
}

We've added the jboss log manager to our dependencies:

    <dependency>
      <groupId>org.jboss.slf4j</groupId>
      <artifactId>slf4j-jboss-logmanager</artifactId>
    </dependency>

When I then check the logs, it shows up as such

2022-02-24T07:58:14.325 [Information] 2022-02-24T07:58:14.308 [INFO] INFO hello to name
2022-02-24T07:58:14.325 [Information] 2022-02-24T07:58:14.308 [WARN] WARN hello to name
2022-02-24T07:58:14.325 [Information] 2022-02-24T07:58:14.308 [ERROR] ERROR hello to name

As you can see, Azure somehow misinterprets our log severity and makes everything show up at the info level.

The first part of every line (like 2022-02-24T07:58:14.325 [Information]) is added by Azure, while the rest of the line is what Quarkus logs to console.

I understand why the first two log entries don't show up, because we set the minimum level to INFO.

From what I understand from the documentation, Azure would automatically recognize the logs. However, this does not appear to be the case for us.

Is there something we've forgotten?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source