forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#42157 from radcortez/fix-42114
Move logging to @ConfigMapping
- Loading branch information
Showing
26 changed files
with
809 additions
and
851 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...t/src/main/java/io/quarkus/deployment/configuration/BuildTimeConfigBuilderCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.deployment.configuration; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import io.quarkus.runtime.LaunchMode; | ||
import io.quarkus.runtime.console.ConsoleRuntimeConfig; | ||
import io.quarkus.runtime.logging.LogBuildTimeConfig; | ||
import io.quarkus.runtime.logging.LogRuntimeConfig; | ||
import io.quarkus.runtime.logging.LoggingSetupRecorder; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
import io.smallrye.config.SmallRyeConfigBuilderCustomizer; | ||
|
||
/** | ||
* Even if the Log and Console mappings are marked as runtime, they are also used during build time. | ||
* <p> | ||
* We cannot register the mappings in the core runtime module because {@link io.smallrye.config.SmallRyeConfig} | ||
* requires ASM to load the mappings. When we run a Quarkus test, Quarkus will generate the bytecode for the mappings, | ||
* so we don't need ASM. In a non-Quarkus tests, ASM must be present in the classpath, which we want | ||
* to avoid (even if they are in the test scope). The logging mappings shouldn't be loaded when running a non-Quarkus | ||
* test because they are not required. | ||
* | ||
* @see LoggingSetupRecorder#initializeBuildTimeLogging(LogRuntimeConfig, LogBuildTimeConfig, ConsoleRuntimeConfig, Map, List, | ||
* LaunchMode) | ||
*/ | ||
public class BuildTimeConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer { | ||
@Override | ||
public void configBuilder(final SmallRyeConfigBuilder builder) { | ||
builder.withMapping(LogBuildTimeConfig.class) | ||
.withMapping(LogRuntimeConfig.class) | ||
.withMapping(ConsoleRuntimeConfig.class); | ||
} | ||
} |
30 changes: 20 additions & 10 deletions
30
core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,45 @@ | ||
package io.quarkus.deployment.console; | ||
|
||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import java.util.Optional; | ||
|
||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
/** | ||
* Console | ||
*/ | ||
@ConfigRoot | ||
public class ConsoleConfig { | ||
|
||
@ConfigMapping(prefix = "quarkus.console") | ||
@ConfigRoot(phase = ConfigPhase.BUILD_TIME) | ||
public interface ConsoleConfig { | ||
/** | ||
* If test results and status should be displayed in the console. | ||
* <p> | ||
* If this is false results can still be viewed in the dev console. | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
public boolean enabled; | ||
@WithDefault("true") | ||
boolean enabled(); | ||
|
||
/** | ||
* Disables the ability to enter input on the console. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean disableInput; | ||
@WithDefault("false") | ||
boolean disableInput(); | ||
|
||
/** | ||
* Disable the testing status/prompt message at the bottom of the console | ||
* and log these messages to STDOUT instead. | ||
* <p> | ||
* Use this option if your terminal does not support ANSI escape sequences. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
public boolean basic; | ||
@WithDefault("false") | ||
boolean basic(); | ||
|
||
/** | ||
* If color should be enabled or disabled. | ||
* <p> | ||
* If this is not present then an attempt will be made to guess if the terminal supports color | ||
*/ | ||
Optional<Boolean> color(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.