Repository: quarkusio/quarkus
Issue: Continuous Testing not using updated log level

## Describe the bug
Quarkus 2.0.0.Final Continous Testing not applying an updated log level changed in application.properties

### Expected behavior
Log level does not change. When app started with default (INFO), and then quarkus.log.level is updated to a higher log level (like TRACE or DEBUG), the logs should include the appropriate logging statements.

### Actual behavior
Logging continues to log at INFO log level.


## To Reproduce

1. Clone the [reproducer git repo](https://github.com/jclingan/continuous_testing_logging).
2. `mvn quarkus:dev`
3. Press 'r' to run tests
4. Press 'o' to enable output
5. Press 'r' to run tests again. Should see:
```
FATAL [org.acm.LoggingResource] ***** JBossLogManagerLogger: FATAL *****
ERROR [org.acm.LoggingResource] ***** JBossLogManagerLogger: ERROR *****
WARN  [org.acm.LoggingResource] ***** JBossLogManagerLogger: WARN *****
INFO  [org.acm.LoggingResource] ***** JBossLogManagerLogger: INFO *****
INFO  [io.quarkus] greeting stopped in 0.009s
```
6. In application.properties, update quarkus.log.level to TRACE.
7. Test will automatically run, and display above text reflecting the log level is still INFO.


Changed files:
core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java
core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java
core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java
core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
index edb9880e8f1..0937a796c36 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
@@ -60,6 +60,7 @@ public class QuarkusAugmentor {
     private final Consumer<ConfigBuilder> configCustomizer;
     private final boolean rebuild;
     private final boolean auxiliaryApplication;
+    private final Optional<DevModeType> auxiliaryDevModeType;
 
     QuarkusAugmentor(Builder builder) {
         this.classLoader = builder.classLoader;
@@ -79,6 +80,7 @@ public class QuarkusAugmentor {
         this.rebuild = builder.rebuild;
         this.devModeType = builder.devModeType;
         this.auxiliaryApplication = builder.auxiliaryApplication;
+        this.auxiliaryDevModeType = Optional.ofNullable(builder.auxiliaryDevModeType);
     }
 
     public BuildResult run() throws Exception {
@@ -143,7 +145,8 @@ public BuildResult run() throws Exception {
                     .produce(new ShutdownContextBuildItem())
                     .produce(new RawCommandLineArgumentsBuildItem())
                     .produce(new LaunchModeBuildItem(launchMode,
-                            devModeType == null ? Optional.empty() : Optional.of(devModeType), auxiliaryApplication))
+                            devModeType == null ? Optional.empty() : Optional.of(devModeType), auxiliaryApplication,
+                            auxiliaryDevModeType))
                     .produce(new BuildSystemTargetBuildItem(targetDir, baseName, rebuild,
                             buildSystemProperties == null ? new Properties() : buildSystemProperties))
                     .produce(new AppModelProviderBuildItem(effectiveModel));
@@ -180,6 +183,7 @@ public static Builder builder() {
 
     public static final class Builder {
 
+        public DevModeType auxiliaryDevModeType;
         boolean rebuild;
         List<PathsCollection> additionalApplicationArchives = new ArrayList<>();
         Collection<Path> excludedFromIndexing = Collections.emptySet();
@@ -223,6 +227,11 @@ public Builder setAuxiliaryApplication(boolean auxiliaryApplication) {
             return this;
         }
 
+        public Builder setAuxiliaryDevModeType(DevModeType auxiliaryDevModeType) {
+            this.auxiliaryDevModeType = auxiliaryDevModeType;
+            return this;
+        }
+
         public LaunchMode getLaunchMode() {
             return launchMode;
         }
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java
index b4e39029e80..917d62c1384 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java
@@ -16,11 +16,14 @@ public final class LaunchModeBuildItem extends SimpleBuildItem {
     private final Optional<DevModeType> devModeType;
 
     private final boolean auxiliaryApplication;
+    private final Optional<DevModeType> auxiliaryDevModeType;
 
-    public LaunchModeBuildItem(LaunchMode launchMode, Optional<DevModeType> devModeType, boolean auxiliaryApplication) {
+    public LaunchModeBuildItem(LaunchMode launchMode, Optional<DevModeType> devModeType, boolean auxiliaryApplication,
+            Optional<DevModeType> auxiliaryDevModeType) {
         this.launchMode = launchMode;
         this.devModeType = devModeType;
         this.auxiliaryApplication = auxiliaryApplication;
+        this.auxiliaryDevModeType = auxiliaryDevModeType;
     }
 
     public LaunchMode getLaunchMode() {
@@ -46,4 +49,12 @@ public Optional<DevModeType> getDevModeType() {
     public boolean isAuxiliaryApplication() {
         return auxiliaryApplication;
     }
+
+    /**
+     * The dev mode type of the main application.
+     *
+     */
+    public Optional<DevModeType> getAuxiliaryDevModeType() {
+        return auxiliaryDevModeType;
+    }
 }
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
index 3faf23f9ce4..c57713a7d9b 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
@@ -278,7 +278,7 @@ private RuntimeUpdatesProcessor setupRuntimeCompilation(DevModeContext context,
             QuarkusCompiler compiler = new QuarkusCompiler(curatedApplication, compilationProviders, context);
             TestSupport testSupport = null;
             if (devModeType == DevModeType.LOCAL && context.getApplicationRoot().getTest().isPresent()) {
-                testSupport = new TestSupport(curatedApplication, compilationProviders, context);
+                testSupport = new TestSupport(curatedApplication, compilationProviders, context, devModeType);
             }
 
             RuntimeUpdatesProcessor processor = new RuntimeUpdatesProcessor(appRoot, context, compiler,
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java
index 5c6b2ecfcfb..d41a827ab7c 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java
@@ -56,7 +56,7 @@ private RuntimeUpdatesProcessor setupRuntimeCompilation(DevModeContext context,
             } catch (Exception e) {
                 throw new RuntimeException("Failed to create compiler", e);
             }
-            TestSupport testSupport = new TestSupport(curatedApplication, compilationProviders, context);
+            TestSupport testSupport = new TestSupport(curatedApplication, compilationProviders, context, DevModeType.TEST_ONLY);
             RuntimeUpdatesProcessor processor = new RuntimeUpdatesProcessor(applicationRoot, context, compiler,
                     DevModeType.TEST_ONLY, this::regenerateApplication,
                     new BiConsumer<DevModeContext.ModuleInfo, String>() {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
index 436150fe1b9..4f85ae678fa 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
@@ -19,6 +19,7 @@
 import io.quarkus.deployment.dev.DevModeContext;
 import io.quarkus.deployment.dev.QuarkusCompiler;
 import io.quarkus.deployment.dev.RuntimeUpdatesProcessor;
+import io.quarkus.dev.spi.DevModeType;
 
 public class TestSupport implements TestController {
 
@@ -29,6 +30,7 @@ public class TestSupport implements TestController {
     final DevModeContext context;
     final List<TestListener> testListeners = new CopyOnWriteArrayList<>();
     final TestState testState = new TestState();
+    final DevModeType devModeType;
 
     volatile CuratedApplication testCuratedApplication;
     volatile QuarkusCompiler compiler;
@@ -45,10 +47,11 @@ public class TestSupport implements TestController {
     volatile TestType testType = TestType.ALL;
 
     public TestSupport(CuratedApplication curatedApplication, List<CompilationProvider> compilationProviders,
-            DevModeContext context) {
+            DevModeContext context, DevModeType devModeType) {
         this.curatedApplication = curatedApplication;
         this.compilationProviders = compilationProviders;
         this.context = context;
+        this.devModeType = devModeType;
     }
 
     public static Optional<TestSupport> instance() {
@@ -128,6 +131,7 @@ public void init() {
                         .setBaseClassLoader(getClass().getClassLoader())
                         .setTest(true)
                         .setAuxiliaryApplication(true)
+                        .setHostApplicationIsTestOnly(devModeType == DevModeType.TEST_ONLY)
                         .setApplicationRoot(PathsCollection.from(paths))
                         .build()
                         .bootstrap();
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
index 07f9a21f9ce..c5e18a7f8f9 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java
@@ -27,6 +27,7 @@
 import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
 import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem;
 import io.quarkus.deployment.pkg.builditem.ProcessInheritIODisabled;
+import io.quarkus.dev.spi.DevModeType;
 import io.quarkus.runtime.LaunchMode;
 
 public class JBangAugmentorImpl implements BiConsumer<CuratedApplication, Map<String, Object>> {
@@ -49,7 +50,11 @@ public void accept(CuratedApplication curatedApplication, Map<String, Object> re
             builder.setBaseName(quarkusBootstrap.getBaseName());
         }
 
-        builder.setAuxiliaryApplication(curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication());
+        boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication();
+        builder.setAuxiliaryApplication(auxiliaryApplication);
+        builder.setAuxiliaryDevModeType(
+                curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly() ? DevModeType.TEST_ONLY
+                        : (auxiliaryApplication ? DevModeType.LOCAL : null));
         builder.setLaunchMode(LaunchMode.NORMAL);
         builder.setRebuild(quarkusBootstrap.isRebuild());
         builder.setLiveReloadState(
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 adbdc7aeb64..b386c6b6ade 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
@@ -36,6 +36,7 @@
 import io.quarkus.deployment.metrics.MetricsCapabilityBuildItem;
 import io.quarkus.deployment.metrics.MetricsFactoryConsumerBuildItem;
 import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild;
+import io.quarkus.dev.spi.DevModeType;
 import io.quarkus.gizmo.AnnotationCreator;
 import io.quarkus.gizmo.BranchResult;
 import io.quarkus.gizmo.BytecodeCreator;
@@ -132,7 +133,8 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(LoggingSetupRecorder recorder, Log
             Optional<ConsoleFormatterBannerBuildItem> possibleBannerBuildItem,
             LaunchModeBuildItem launchModeBuildItem,
             List<LogCleanupFilterBuildItem> logCleanupFilters) {
-        if (!launchModeBuildItem.isAuxiliaryApplication()) {
+        if (!launchModeBuildItem.isAuxiliaryApplication()
+                || launchModeBuildItem.getAuxiliaryDevModeType().orElse(null) == DevModeType.TEST_ONLY) {
             final List<RuntimeValue<Optional<Handler>>> handlers = handlerBuildItems.stream()
                     .map(LogHandlerBuildItem::getHandlerValue)
                     .collect(Collectors.toList());
diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
index c4c6ce571e4..61712cc6096 100644
--- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java
@@ -326,10 +326,14 @@ public BuildResult runCustomAction(Consumer<BuildChainBuilder> chainBuild, Consu
 
             BuildChain chain = chainBuilder
                     .build();
+            boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication();
             BuildExecutionBuilder execBuilder = chain.createExecutionBuilder("main")
                     .produce(new LaunchModeBuildItem(launchMode,
                             devModeType == null ? Optional.empty() : Optional.of(devModeType),
-                            curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication()))
+                            auxiliaryApplication,
+                            Optional.ofNullable(curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly()
+                                    ? DevModeType.TEST_ONLY
+                                    : (auxiliaryApplication ? DevModeType.LOCAL : null))))
                     .produce(new ShutdownContextBuildItem())
                     .produce(new RawCommandLineArgumentsBuildItem())
                     .produce(new LiveReloadBuildItem());
@@ -373,7 +377,11 @@ private BuildResult runAugment(boolean firstRun, Set<String> changedResources,
                 builder.setBaseName(quarkusBootstrap.getBaseName());
             }
 
-            builder.setAuxiliaryApplication(curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication());
+            boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication();
+            builder.setAuxiliaryApplication(auxiliaryApplication);
+            builder.setAuxiliaryDevModeType(
+                    curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly() ? DevModeType.TEST_ONLY
+                            : (auxiliaryApplication ? DevModeType.LOCAL : null));
             builder.setLaunchMode(launchMode);
             builder.setDevModeType(devModeType);
             builder.setRebuild(quarkusBootstrap.isRebuild());
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java
index 76ea85a96be..13688fa8f34 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java
@@ -90,6 +90,7 @@ public class QuarkusBootstrap implements Serializable {
     private final Set<AppArtifactKey> localArtifacts;
     private final List<ClassLoaderEventListener> classLoadListeners;
     private final boolean auxiliaryApplication;
+    private final boolean hostApplicationIsTestOnly;
     private final boolean flatClassPath;
     private final ConfiguredClassLoading classLoadingConfig;
 
@@ -124,6 +125,7 @@ private QuarkusBootstrap(Builder builder, ConfiguredClassLoading classLoadingCon
         this.auxiliaryApplication = builder.auxiliaryApplication;
         this.flatClassPath = builder.flatClassPath;
         this.classLoadingConfig = classLoadingConfig;
+        this.hostApplicationIsTestOnly = builder.hostApplicationIsTestOnly;
     }
 
     public CuratedApplication bootstrap() throws BootstrapException {
@@ -248,6 +250,10 @@ public boolean isAuxiliaryApplication() {
         return auxiliaryApplication;
     }
 
+    public boolean isHostApplicationIsTestOnly() {
+        return hostApplicationIsTestOnly;
+    }
+
     public static Builder builder() {
         return new Builder();
     }
@@ -323,6 +329,7 @@ public boolean isFlatClassPath() {
 
     public static class Builder {
         public List<ClassLoaderEventListener> classLoadListeners = new ArrayList<>();
+        public boolean hostApplicationIsTestOnly;
         boolean flatClassPath;
         boolean rebuild;
         PathsCollection applicationRoot;
@@ -421,6 +428,11 @@ public Builder setMode(Mode mode) {
             return this;
         }
 
+        public Builder setHostApplicationIsTestOnly(boolean hostApplicationIsTestOnly) {
+            this.hostApplicationIsTestOnly = hostApplicationIsTestOnly;
+            return this;
+        }
+
         public Builder setAuxiliaryApplication(boolean auxiliaryApplication) {
             this.auxiliaryApplication = auxiliaryApplication;
             return this;