From aab9c771b1dce43d7b4de9ff87c758d718533fad Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Tue, 15 Jun 2021 11:15:46 +0300 Subject: [PATCH] Take 'enable' field into account for named logging handlers Fixes: #17913 --- .../runtime/logging/LoggingSetupRecorder.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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 3fd7f1c3e1220..b734842a281a4 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 @@ -248,16 +248,28 @@ private static Map createNamedHandlers(LogConfig config, List filterElements) { Map namedHandlers = new HashMap<>(); for (Entry consoleConfigEntry : config.consoleHandlers.entrySet()) { - final Handler consoleHandler = configureConsoleHandler(consoleConfigEntry.getValue(), errorManager, filterElements, + ConsoleConfig namedConsoleConfig = consoleConfigEntry.getValue(); + if (!namedConsoleConfig.enable) { + continue; + } + final Handler consoleHandler = configureConsoleHandler(namedConsoleConfig, errorManager, filterElements, possibleFormatters, null); addToNamedHandlers(namedHandlers, consoleHandler, consoleConfigEntry.getKey()); } for (Entry fileConfigEntry : config.fileHandlers.entrySet()) { - final Handler fileHandler = configureFileHandler(fileConfigEntry.getValue(), errorManager, filterElements); + FileConfig namedFileConfig = fileConfigEntry.getValue(); + if (!namedFileConfig.enable) { + continue; + } + final Handler fileHandler = configureFileHandler(namedFileConfig, errorManager, filterElements); addToNamedHandlers(namedHandlers, fileHandler, fileConfigEntry.getKey()); } for (Entry sysLogConfigEntry : config.syslogHandlers.entrySet()) { - final Handler syslogHandler = configureSyslogHandler(sysLogConfigEntry.getValue(), errorManager, filterElements); + SyslogConfig namedSyslogConfig = sysLogConfigEntry.getValue(); + if (!namedSyslogConfig.enable) { + continue; + } + final Handler syslogHandler = configureSyslogHandler(namedSyslogConfig, errorManager, filterElements); if (syslogHandler != null) { addToNamedHandlers(namedHandlers, syslogHandler, sysLogConfigEntry.getKey()); }