diff --git a/nucleus/common/common-util/src/main/java/com/sun/common/util/logging/LoggingConfigImpl.java b/nucleus/common/common-util/src/main/java/com/sun/common/util/logging/LoggingConfigImpl.java index b9a01f95b8e..e95e918aa29 100644 --- a/nucleus/common/common-util/src/main/java/com/sun/common/util/logging/LoggingConfigImpl.java +++ b/nucleus/common/common-util/src/main/java/com/sun/common/util/logging/LoggingConfigImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation + * Copyright (c) 2022, 2024 Contributors to the Eclipse Foundation * Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the @@ -232,7 +232,7 @@ public synchronized String setLoggingProperty(String propertyName, String proper setWebLoggers(propertyValue); } - closePropFile(""); + closePropFile(null); return property; } @@ -298,7 +298,7 @@ public synchronized Map updateLoggingProperties(Map deleteLoggingProperties(final Collection LOG.log(Level.INFO, "deleteLoggingProperties(properties={0})", properties); loadLoggingProperties(); remove(properties); - rewritePropertiesFileAndNotifyMonitoring(); + rewritePropertiesFileAndNotifyMonitoring(null); return setMissingDefaults(getLoggingProperties()); } @@ -394,10 +394,10 @@ public synchronized Map deleteLoggingProperties(final Collection public synchronized Map deleteLoggingProperties(final Collection properties, final String target) throws IOException { LOG.log(Level.INFO, "deleteLoggingProperties(properties={0}, target={1})", new Object[] {properties, target}); - loadLoggingProperties(); + loadLoggingProperties(target); remove(properties); - rewritePropertiesFileAndNotifyMonitoring(); - return setMissingDefaults(getLoggingProperties()); + rewritePropertiesFileAndNotifyMonitoring(target); + return setMissingDefaults(getLoggingProperties(target)); } private void remove(final Collection keys) { @@ -405,10 +405,15 @@ private void remove(final Collection keys) { keys.forEach(toRealKeyAndDelete); } - private void rewritePropertiesFileAndNotifyMonitoring() throws IOException { + private void rewritePropertiesFileAndNotifyMonitoring(final String targetConfigName) throws IOException { LOG.finest("rewritePropertiesFileAndNotifyMonitoring"); - File file = getLoggingPropertiesFile(); - File parentFile = file.getParentFile(); + final File file; + if (targetConfigName == null || targetConfigName.isEmpty()) { + file = getLoggingPropertiesFile(); + } else { + file = getLoggingPropertiesFile(targetConfigName); + } + final File parentFile = file.getParentFile(); if (!parentFile.exists() && !parentFile.mkdirs()) { throw new IOException( "Directory '" + parentFile + "' does not exist, cannot create logging.properties file!");