diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/ConsoleConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/ConsoleConfig.java index b9abbfaf288e12..dd19a6c0db000a 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/ConsoleConfig.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/ConsoleConfig.java @@ -1,5 +1,6 @@ package io.quarkus.runtime.logging; +import java.util.Optional; import java.util.logging.Level; import io.quarkus.runtime.annotations.ConfigGroup; @@ -29,10 +30,11 @@ public class ConsoleConfig { Level level; /** - * If the console logging should be in color + * If the console logging should be in color. If undefined quarkus takes + * best guess based on operating system and environment. */ - @ConfigItem(defaultValue = "true") - boolean color; + @ConfigItem() + Optional color; /** * Specify how much the colors should be darkened diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java index 4d6fee44f73035..e613c0aba54479 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java @@ -122,7 +122,7 @@ private boolean hasColorSupport() { private ErrorManager configureConsoleHandler(ConsoleConfig config, ErrorManager errorManager, List filterElements, ArrayList handlers) { final PatternFormatter formatter; - if (config.color && hasColorSupport()) { + if (config.color.orElse(hasColorSupport())) { formatter = new ColorPatternFormatter(config.darken, config.format); } else { formatter = new PatternFormatter(config.format);