Author: fanningpj
Date: Thu Nov 21 09:55:48 2024
New Revision: 1921989

URL: http://svn.apache.org/viewvc?rev=1921989&view=rev
Log:
XmlBeansLogManager handle null logger case

Modified:
    
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java

Modified: 
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java
URL: 
http://svn.apache.org/viewvc/xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java?rev=1921989&r1=1921988&r2=1921989&view=diff
==============================================================================
--- 
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java
 (original)
+++ 
xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java
 Thu Nov 21 09:55:48 2024
@@ -36,11 +36,19 @@ public final class XmlBeansLogManager {
     }
 
     public static Logger getLogger(Class<?> clz) {
+        final long time = System.currentTimeMillis();
         try {
-            return LogManager.getLogger(clz);
+            final Logger logger = LogManager.getLogger(clz);
+            if (logger == null) {
+                if (time > LAST_TIME + SLEEP_TIME) {
+                    LAST_TIME = time;
+                    System.err.println("Log4J returned null logger. Falling 
back to No-Op logger.");
+                }
+                return NoOpLogger.INSTANCE;
+            }
+            return logger;
         } catch (Throwable t) {
             if (!ExceptionUtil.isFatal(t)) {
-                final long time = System.currentTimeMillis();
                 if (time > LAST_TIME + SLEEP_TIME) {
                     LAST_TIME = time;
                     System.err.println("Issue loading Log4J. Falling back to 
No-Op logger.");



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to