This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 76f13e3880c1719b32cdb977d80fa4b8985ddb37
Author: Andy Seaborne <[email protected]>
AuthorDate: Sun Jun 9 19:33:36 2024 +0100

    Reset JUL LogManger before resetting the configuration
---
 .../src/main/java/org/apache/jena/atlas/logging/LogCtlJUL.java    | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/jena-base/src/main/java/org/apache/jena/atlas/logging/LogCtlJUL.java 
b/jena-base/src/main/java/org/apache/jena/atlas/logging/LogCtlJUL.java
index ccc898d56a..495b6bbe2c 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/logging/LogCtlJUL.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/logging/LogCtlJUL.java
@@ -69,7 +69,13 @@ public class LogCtlJUL {
 
     static void readJavaLoggingConfiguration(InputStream details) throws 
Exception {
         System.setProperty(JUL_PROPERTY, "set");
-        
java.util.logging.LogManager.getLogManager().readConfiguration(details);
+        java.util.logging.LogManager logManager = 
java.util.logging.LogManager.getLogManager();
+        // Calling .reset, stops the ConsoleHandler closing System.err.
+        // readConfiguration (or updateConfiguration) will shutdown cleanly 
and ConsoleHandler.close is called.
+        // That calls System.err.close()
+        // See ConsoleHandlerStream in this package, a variant that does not 
close the PrintStream.
+        logManager.reset();
+        logManager.readConfiguration(details);
     }
 
     private static boolean setJavaLoggingClasspath(String resourceName) {

Reply via email to