Skip to content

Commit

Permalink
Do not pass RuntimeValue's to initializeBuildTimeLogging
Browse files Browse the repository at this point in the history
Despite being part of the recorder, it is called statically at build
time. We need to be extremely careful about it.

Fixes quarkusio#26773

(cherry picked from commit d125cd8)
  • Loading branch information
gsmet committed Jul 19, 2022
1 parent 6056a0d commit 82b514b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(RecorderContext context, LoggingSe
ConsoleRuntimeConfig crc = new ConsoleRuntimeConfig();
ConfigInstantiator.handleObject(crc);
LoggingSetupRecorder.initializeBuildTimeLogging(logConfig, buildLog, categoryMinLevelDefaults.content,
crc, possibleFileFormatters, launchModeBuildItem.getLaunchMode());
crc, launchModeBuildItem.getLaunchMode());
((QuarkusClassLoader) Thread.currentThread().getContextClassLoader()).addCloseTask(new Runnable() {
@Override
public void run() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,13 @@ public void accept(String categoryName, CategoryConfig config) {
InitialConfigurator.DELAYED_HANDLER.setHandlers(handlers.toArray(EmbeddedConfigurator.NO_HANDLERS));
}

/**
* WARNING: this method is part of the recorder but is actually called statically at build time.
* You may not push RuntimeValue's to it.
*/
public static void initializeBuildTimeLogging(LogConfig config, LogBuildTimeConfig buildConfig,
Map<String, InheritableLevel> categoryDefaultMinLevels,
ConsoleRuntimeConfig consoleConfig, List<RuntimeValue<Optional<Formatter>>> possibleFileFormatters,
ConsoleRuntimeConfig consoleConfig,
LaunchMode launchMode) {

final Map<String, CategoryConfig> categories = config.categories;
Expand Down Expand Up @@ -266,7 +270,7 @@ public static void initializeBuildTimeLogging(LogConfig config, LogBuildTimeConf

Map<String, Handler> namedHandlers = createNamedHandlers(config, consoleConfig, Collections.emptyList(),
Collections.emptyList(),
possibleFileFormatters, errorManager, logCleanupFilter, launchMode);
Collections.emptyList(), errorManager, logCleanupFilter, launchMode);

for (Map.Entry<String, CategoryConfig> entry : categories.entrySet()) {
final String categoryName = entry.getKey();
Expand Down

0 comments on commit 82b514b

Please sign in to comment.