You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by fa...@apache.org on 2024/11/24 19:19:52 UTC
svn commit: r1922053 - /xmlbeans/trunk/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java
Author: fanningpj
Date: Sun Nov 24 19:19:52 2024
New Revision: 1922053
URL: http://svn.apache.org/viewvc?rev=1922053&view=rev
Log:
XmlBeansLogManager
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=1922053&r1=1922052&r2=1922053&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 Sun Nov 24 19:19:52 2024
@@ -36,12 +36,10 @@ public final class XmlBeansLogManager {
}
public static Logger getLogger(Class<?> clz) {
- final long time = System.currentTimeMillis();
try {
final Logger logger = LogManager.getLogger(clz);
if (logger == null) {
- if (time > LAST_TIME + SLEEP_TIME) {
- LAST_TIME = time;
+ if (shouldLog()) {
System.err.println("[XmlBeansLogManager] Log4J returned null logger. Falling back to No-Op logger.");
}
return NoOpLogger.INSTANCE;
@@ -49,8 +47,7 @@ public final class XmlBeansLogManager {
return logger;
} catch (Throwable t) {
if (!ExceptionUtil.isFatal(t)) {
- if (time > LAST_TIME + SLEEP_TIME) {
- LAST_TIME = time;
+ if (shouldLog()) {
System.err.println("[XmlBeansLogManager] Issue loading Log4J. Falling back to No-Op logger.");
t.printStackTrace();
}
@@ -59,4 +56,13 @@ public final class XmlBeansLogManager {
}
}
+ private static synchronized boolean shouldLog() {
+ final long time = System.currentTimeMillis();
+ if (time > LAST_TIME + SLEEP_TIME) {
+ LAST_TIME = time;
+ return true;
+ }
+ return false;
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org