Skip to content

Commit

Permalink
Take 'enable' field into account for named logging handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
geoand committed Jun 15, 2021
1 parent 74dca07 commit aab9c77
Showing 1 changed file with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,16 +248,28 @@ private static Map<String, Handler> createNamedHandlers(LogConfig config,
List<LogCleanupFilterElement> filterElements) {
Map<String, Handler> namedHandlers = new HashMap<>();
for (Entry<String, ConsoleConfig> 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<String, FileConfig> 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<String, SyslogConfig> 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());
}
Expand Down

0 comments on commit aab9c77

Please sign in to comment.