Repository: quarkusio/quarkus
Issue: Log regression in 1.11.0.CR1 with native build and yaml configuration

**Describe the bug**
Log level isn't set using the following snippet:
```
Logger log = Logger.getLogger(GreetingResource.class);

log.debug("hello debug");
log.info("hello info");
```
Please note this is a regression in 1.11.0.CR1 compared to 1.10.5.Final.

**Expected behavior**
Logging in DEBUG should be shown in the application output with both builds.

**Actual behavior**
Only INFO level is shown in native whereas both are with jvm build.

**To Reproduce**
I have setup a public repo (https://github.com/matthyx/quarkus-getting-started) with 2 branches containing the same example in both versions.

Steps to reproduce the behavior:
1. git clone https://github.com/matthyx/quarkus-getting-started.git
2. ./mvnw package
3. ./mvnw package -Pnative -Dquarkus.native.container-build=true
4. cd mytest
5. ../target/getting-started-1.0.0-SNAPSHOT-runner
6. (separate terminal) curl http://127.0.0.1:8080/hello
7. java -jar ../target/getting-started-1.0.0-SNAPSHOT-runner.jar
8. (separate terminal) curl http://127.0.0.1:8080/hello

**Configuration**
```properties
# src/main/resources/application.yml
quarkus:
  log:
    min-level: DEBUG
```
```properties
# config/application.yml
quarkus:
  http:
    port: 18080
  log:
    category:
      "org.acme.getting.started":
        level: TRACE
```

**Environment (please complete the following information):**
 - Output of `uname -a` or `ver`: Linux parrot 5.9.0-2parrot1-amd64 #1 SMP Debian 5.9.6-2parrot1 (2020-11-17) x86_64 GNU/Linux
 - Output of `java -version`: openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment (build 11.0.9.1+1-post-Debian-1) OpenJDK 64-Bit Server VM (build 11.0.9.1+1-post-Debian-1, mixed mode, sharing)
 - GraalVM version (if different from Java): quay.io/quarkus/ubi-quarkus-native-image   20.3.0-java11
 - Quarkus version or git rev: 1.11.0.CR1
 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)

Changed files:
core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
index 5e91d51af1f..6d21c64f18b 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java
@@ -171,23 +171,22 @@ void registerMetrics(LogMetricsHandlerRecorder recorder, LogBuildTimeConfig log,
     void setUpMinLevelLogging(LogBuildTimeConfig log,
             final BuildProducer<GeneratedClassBuildItem> generatedTraceLogger) {
         ClassOutput output = new GeneratedClassGizmoAdaptor(generatedTraceLogger, false);
-        if (log.categories.isEmpty() || allMinLevelInfoOrHigher(log.categories)) {
-            generateDefaultLoggers(output);
+        if (log.categories.isEmpty() || allMinLevelInfoOrHigher(log.minLevel.intValue(), log.categories)) {
+            generateDefaultLoggers(log.minLevel, output);
         } else {
             generateCategoryMinLevelLoggers(log.categories, log.minLevel, output);
         }
     }
 
-    private static boolean allMinLevelInfoOrHigher(Map<String, CategoryBuildTimeConfig> categories) {
+    private static boolean allMinLevelInfoOrHigher(int minLogLevel, Map<String, CategoryBuildTimeConfig> categories) {
         return categories.values().stream()
-                .allMatch(categoryConfig -> categoryConfig.minLevel.getLevel().intValue() >= org.jboss.logmanager.Level.INFO
-                        .intValue());
+                .allMatch(categoryConfig -> categoryConfig.minLevel.getLevel().intValue() >= minLogLevel);
     }
 
-    private static void generateDefaultLoggers(ClassOutput output) {
-        generateDefaultLoggingLogger(output);
+    private static void generateDefaultLoggers(Level minLevel, ClassOutput output) {
+        generateDefaultLoggingLogger(minLevel, output);
         generateDefaultLoggerNode(output);
-        generateLogManagerLogger(output, LoggingResourceProcessor::generateMinLevelDefault);
+        generateLogManagerLogger(output, LoggingResourceProcessor.generateMinLevelDefault(minLevel.getName()));
     }
 
     private static void generateCategoryMinLevelLoggers(Map<String, CategoryBuildTimeConfig> categories, Level minLevel,
@@ -307,10 +306,13 @@ private static ResultHandle getParamLevelIntValue(MethodCreator method) {
                 .invokeVirtualMethod(MethodDescriptor.ofMethod(Level.class, "intValue", int.class), level);
     }
 
-    private static BranchResult generateMinLevelDefault(MethodCreator method, FieldDescriptor nameAliasDescriptor) {
-        final ResultHandle levelIntValue = getParamLevelIntValue(method);
-        final ResultHandle infoLevelIntValue = getLogManagerLevelIntValue("INFO", method);
-        return method.ifIntegerGreaterEqual(levelIntValue, infoLevelIntValue);
+    private static BiFunction<MethodCreator, FieldDescriptor, BranchResult> generateMinLevelDefault(
+            String defaultMinLevelName) {
+        return (method, nameAliasDescriptor) -> {
+            final ResultHandle levelIntValue = getParamLevelIntValue(method);
+            final ResultHandle infoLevelIntValue = getLogManagerLevelIntValue(defaultMinLevelName, method);
+            return method.ifIntegerGreaterEqual(levelIntValue, infoLevelIntValue);
+        };
     }
 
     private static ResultHandle getLogManagerLevelIntValue(String levelName, BytecodeCreator method) {
@@ -320,7 +322,7 @@ private static ResultHandle getLogManagerLevelIntValue(String levelName, Bytecod
                 .invokeVirtualMethod(MethodDescriptor.ofMethod(Level.class, "intValue", int.class), infoLevel);
     }
 
-    private static void generateDefaultLoggingLogger(ClassOutput output) {
+    private static void generateDefaultLoggingLogger(Level minLevel, ClassOutput output) {
         try (ClassCreator cc = ClassCreator.builder().setFinal(true)
                 .className(LOGGING_LOGGER_CLASS_NAME)
                 .classOutput(output).build()) {
@@ -328,10 +330,14 @@ private static void generateDefaultLoggingLogger(ClassOutput output) {
             AnnotationCreator targetClass = cc.addAnnotation("com.oracle.svm.core.annotate.TargetClass");
             targetClass.addValue("className", "org.jboss.logging.Logger");
 
-            // Constant fold these methods to return false,
-            // since the build time log level is above this level.
-            generateFalseFoldMethod("isTraceEnabled", cc);
-            generateFalseFoldMethod("isDebugEnabled", cc);
+            if (minLevel.intValue() >= org.jboss.logmanager.Level.INFO.intValue()) {
+                // Constant fold these methods to return false,
+                // since the build time log level is above this level.
+                generateFalseFoldMethod("isTraceEnabled", cc);
+                generateFalseFoldMethod("isDebugEnabled", cc);
+            } else if (minLevel.intValue() == org.jboss.logmanager.Level.DEBUG.intValue()) {
+                generateFalseFoldMethod("isTraceEnabled", cc);
+            }
         }
     }