diff --git a/src/main/java/org/apache/xmlbeans/impl/common/DocumentHelper.java b/src/main/java/org/apache/xmlbeans/impl/common/DocumentHelper.java index 2e2dfc640..6092f848e 100644 --- a/src/main/java/org/apache/xmlbeans/impl/common/DocumentHelper.java +++ b/src/main/java/org/apache/xmlbeans/impl/common/DocumentHelper.java @@ -15,9 +15,9 @@ package org.apache.xmlbeans.impl.common; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.XmlOptions; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import org.apache.xmlbeans.impl.util.ExceptionUtil; import org.w3c.dom.Document; import org.xml.sax.ErrorHandler; @@ -35,7 +35,7 @@ import java.util.concurrent.TimeUnit; public final class DocumentHelper { - private static final Logger LOG = LogManager.getLogger(DocumentHelper.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(DocumentHelper.class); private static long lastLog; private DocumentHelper() {} diff --git a/src/main/java/org/apache/xmlbeans/impl/common/SAXHelper.java b/src/main/java/org/apache/xmlbeans/impl/common/SAXHelper.java index 5193026bf..aab43c002 100644 --- a/src/main/java/org/apache/xmlbeans/impl/common/SAXHelper.java +++ b/src/main/java/org/apache/xmlbeans/impl/common/SAXHelper.java @@ -15,9 +15,9 @@ package org.apache.xmlbeans.impl.common; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.XmlOptions; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import org.apache.xmlbeans.impl.util.ExceptionUtil; import org.xml.sax.EntityResolver; import org.xml.sax.InputSource; @@ -35,7 +35,7 @@ * Provides handy methods for working with SAX parsers and readers */ public final class SAXHelper { - private static final Logger LOG = LogManager.getLogger(SAXHelper.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(SAXHelper.class); private static long lastLog; private SAXHelper() { diff --git a/src/main/java/org/apache/xmlbeans/impl/common/StaxHelper.java b/src/main/java/org/apache/xmlbeans/impl/common/StaxHelper.java index f787102d2..2b4716a9f 100644 --- a/src/main/java/org/apache/xmlbeans/impl/common/StaxHelper.java +++ b/src/main/java/org/apache/xmlbeans/impl/common/StaxHelper.java @@ -15,9 +15,9 @@ package org.apache.xmlbeans.impl.common; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.XmlOptions; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import javax.xml.stream.XMLEventFactory; import javax.xml.stream.XMLInputFactory; @@ -27,7 +27,7 @@ * Provides handy methods for working with StAX parsers and readers */ public final class StaxHelper { - private static final Logger LOG = LogManager.getLogger(StaxHelper.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(StaxHelper.class); private StaxHelper() {} diff --git a/src/main/java/org/apache/xmlbeans/impl/common/XBeanDebug.java b/src/main/java/org/apache/xmlbeans/impl/common/XBeanDebug.java index 7efe23ce0..4db260520 100644 --- a/src/main/java/org/apache/xmlbeans/impl/common/XBeanDebug.java +++ b/src/main/java/org/apache/xmlbeans/impl/common/XBeanDebug.java @@ -15,9 +15,9 @@ package org.apache.xmlbeans.impl.common; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; public class XBeanDebug { - public static final Logger LOG = LogManager.getLogger(XBeanDebug.class); + public static final Logger LOG = XmlBeansLogManager.getLogger(XBeanDebug.class); } diff --git a/src/main/java/org/apache/xmlbeans/impl/config/ChildSolverCollectionStrategy.java b/src/main/java/org/apache/xmlbeans/impl/config/ChildSolverCollectionStrategy.java index a19d495a1..2ee524314 100644 --- a/src/main/java/org/apache/xmlbeans/impl/config/ChildSolverCollectionStrategy.java +++ b/src/main/java/org/apache/xmlbeans/impl/config/ChildSolverCollectionStrategy.java @@ -21,8 +21,8 @@ import com.github.javaparser.symbolsolver.resolution.typesolvers.JavaParserTypeSolver; import com.github.javaparser.utils.CollectionStrategy; import com.github.javaparser.utils.ProjectRoot; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import java.io.IOException; import java.nio.file.*; @@ -38,7 +38,7 @@ * for further lookups */ class ChildSolverCollectionStrategy implements CollectionStrategy { - private static final Logger LOG = LogManager.getLogger(ChildSolverCollectionStrategy.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(ChildSolverCollectionStrategy.class); private final ParserConfiguration config; private final PathMatcher javaMatcher = getPathMatcher("glob:**.java"); diff --git a/src/main/java/org/apache/xmlbeans/impl/logging/NoOpLogger.java b/src/main/java/org/apache/xmlbeans/impl/logging/NoOpLogger.java new file mode 100644 index 000000000..1f69f3938 --- /dev/null +++ b/src/main/java/org/apache/xmlbeans/impl/logging/NoOpLogger.java @@ -0,0 +1,1909 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.impl.logging; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Logger; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.EntryMessage; +import org.apache.logging.log4j.message.FlowMessageFactory; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.util.MessageSupplier; +import org.apache.logging.log4j.util.Supplier; + +/** + * A No-Op implementation of the Log4J Logger interface. + */ +final class NoOpLogger implements Logger { + + static final NoOpLogger INSTANCE = new NoOpLogger(); + + @Override + public void catching(Level level, Throwable throwable) { + + } + + @Override + public void catching(Throwable throwable) { + + } + + @Override + public void debug(Marker marker, Message message) { + + } + + @Override + public void debug(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void debug(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, CharSequence message) { + + } + + @Override + public void debug(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, Object message) { + + } + + @Override + public void debug(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, String message) { + + } + + @Override + public void debug(Marker marker, String message, Object... params) { + + } + + @Override + public void debug(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void debug(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void debug(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void debug(Message message) { + + } + + @Override + public void debug(Message message, Throwable throwable) { + + } + + @Override + public void debug(MessageSupplier messageSupplier) { + + } + + @Override + public void debug(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void debug(CharSequence message) { + + } + + @Override + public void debug(CharSequence message, Throwable throwable) { + + } + + @Override + public void debug(Object message) { + + } + + @Override + public void debug(Object message, Throwable throwable) { + + } + + @Override + public void debug(String message) { + + } + + @Override + public void debug(String message, Object... params) { + + } + + @Override + public void debug(String message, Supplier... paramSuppliers) { + + } + + @Override + public void debug(String message, Throwable throwable) { + + } + + @Override + public void debug(Supplier messageSupplier) { + + } + + @Override + public void debug(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void debug(Marker marker, String message, Object p0) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void debug(String message, Object p0) { + + } + + @Override + public void debug(String message, Object p0, Object p1) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void entry() { + + } + + @Override + public void entry(Object... params) { + + } + + @Override + public void error(Marker marker, Message message) { + + } + + @Override + public void error(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void error(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void error(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void error(Marker marker, CharSequence message) { + + } + + @Override + public void error(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void error(Marker marker, Object message) { + + } + + @Override + public void error(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void error(Marker marker, String message) { + + } + + @Override + public void error(Marker marker, String message, Object... params) { + + } + + @Override + public void error(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void error(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void error(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void error(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void error(Message message) { + + } + + @Override + public void error(Message message, Throwable throwable) { + + } + + @Override + public void error(MessageSupplier messageSupplier) { + + } + + @Override + public void error(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void error(CharSequence message) { + + } + + @Override + public void error(CharSequence message, Throwable throwable) { + + } + + @Override + public void error(Object message) { + + } + + @Override + public void error(Object message, Throwable throwable) { + + } + + @Override + public void error(String message) { + + } + + @Override + public void error(String message, Object... params) { + + } + + @Override + public void error(String message, Supplier... paramSuppliers) { + + } + + @Override + public void error(String message, Throwable throwable) { + + } + + @Override + public void error(Supplier messageSupplier) { + + } + + @Override + public void error(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void error(Marker marker, String message, Object p0) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void error(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void error(String message, Object p0) { + + } + + @Override + public void error(String message, Object p0, Object p1) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void error(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void exit() { + + } + + @Override + public R exit(R result) { + return null; + } + + @Override + public void fatal(Marker marker, Message message) { + + } + + @Override + public void fatal(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void fatal(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, CharSequence message) { + + } + + @Override + public void fatal(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, Object message) { + + } + + @Override + public void fatal(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, String message) { + + } + + @Override + public void fatal(Marker marker, String message, Object... params) { + + } + + @Override + public void fatal(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void fatal(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void fatal(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void fatal(Message message) { + + } + + @Override + public void fatal(Message message, Throwable throwable) { + + } + + @Override + public void fatal(MessageSupplier messageSupplier) { + + } + + @Override + public void fatal(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void fatal(CharSequence message) { + + } + + @Override + public void fatal(CharSequence message, Throwable throwable) { + + } + + @Override + public void fatal(Object message) { + + } + + @Override + public void fatal(Object message, Throwable throwable) { + + } + + @Override + public void fatal(String message) { + + } + + @Override + public void fatal(String message, Object... params) { + + } + + @Override + public void fatal(String message, Supplier... paramSuppliers) { + + } + + @Override + public void fatal(String message, Throwable throwable) { + + } + + @Override + public void fatal(Supplier messageSupplier) { + + } + + @Override + public void fatal(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void fatal(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void fatal(String message, Object p0) { + + } + + @Override + public void fatal(String message, Object p0, Object p1) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void fatal(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public Level getLevel() { + return null; + } + + @Override + public MF getMessageFactory() { + return null; + } + + @Override + public FlowMessageFactory getFlowMessageFactory() { + return null; + } + + @Override + public String getName() { + return ""; + } + + @Override + public void info(Marker marker, Message message) { + + } + + @Override + public void info(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void info(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void info(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void info(Marker marker, CharSequence message) { + + } + + @Override + public void info(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void info(Marker marker, Object message) { + + } + + @Override + public void info(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void info(Marker marker, String message) { + + } + + @Override + public void info(Marker marker, String message, Object... params) { + + } + + @Override + public void info(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void info(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void info(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void info(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void info(Message message) { + + } + + @Override + public void info(Message message, Throwable throwable) { + + } + + @Override + public void info(MessageSupplier messageSupplier) { + + } + + @Override + public void info(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void info(CharSequence message) { + + } + + @Override + public void info(CharSequence message, Throwable throwable) { + + } + + @Override + public void info(Object message) { + + } + + @Override + public void info(Object message, Throwable throwable) { + + } + + @Override + public void info(String message) { + + } + + @Override + public void info(String message, Object... params) { + + } + + @Override + public void info(String message, Supplier... paramSuppliers) { + + } + + @Override + public void info(String message, Throwable throwable) { + + } + + @Override + public void info(Supplier messageSupplier) { + + } + + @Override + public void info(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void info(Marker marker, String message, Object p0) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void info(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void info(String message, Object p0) { + + } + + @Override + public void info(String message, Object p0, Object p1) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void info(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public boolean isDebugEnabled() { + return false; + } + + @Override + public boolean isDebugEnabled(Marker marker) { + return false; + } + + @Override + public boolean isEnabled(Level level) { + return false; + } + + @Override + public boolean isEnabled(Level level, Marker marker) { + return false; + } + + @Override + public boolean isErrorEnabled() { + return false; + } + + @Override + public boolean isErrorEnabled(Marker marker) { + return false; + } + + @Override + public boolean isFatalEnabled() { + return false; + } + + @Override + public boolean isFatalEnabled(Marker marker) { + return false; + } + + @Override + public boolean isInfoEnabled() { + return false; + } + + @Override + public boolean isInfoEnabled(Marker marker) { + return false; + } + + @Override + public boolean isTraceEnabled() { + return false; + } + + @Override + public boolean isTraceEnabled(Marker marker) { + return false; + } + + @Override + public boolean isWarnEnabled() { + return false; + } + + @Override + public boolean isWarnEnabled(Marker marker) { + return false; + } + + @Override + public void log(Level level, Marker marker, Message message) { + + } + + @Override + public void log(Level level, Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void log(Level level, Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, CharSequence message) { + + } + + @Override + public void log(Level level, Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, Object message) { + + } + + @Override + public void log(Level level, Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, String message) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object... params) { + + } + + @Override + public void log(Level level, Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void log(Level level, Marker marker, String message, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, Supplier messageSupplier) { + + } + + @Override + public void log(Level level, Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void log(Level level, Message message) { + + } + + @Override + public void log(Level level, Message message, Throwable throwable) { + + } + + @Override + public void log(Level level, MessageSupplier messageSupplier) { + + } + + @Override + public void log(Level level, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void log(Level level, CharSequence message) { + + } + + @Override + public void log(Level level, CharSequence message, Throwable throwable) { + + } + + @Override + public void log(Level level, Object message) { + + } + + @Override + public void log(Level level, Object message, Throwable throwable) { + + } + + @Override + public void log(Level level, String message) { + + } + + @Override + public void log(Level level, String message, Object... params) { + + } + + @Override + public void log(Level level, String message, Supplier... paramSuppliers) { + + } + + @Override + public void log(Level level, String message, Throwable throwable) { + + } + + @Override + public void log(Level level, Supplier messageSupplier) { + + } + + @Override + public void log(Level level, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void log(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void log(Level level, String message, Object p0) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void log(Level level, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void printf(Level level, Marker marker, String format, Object... params) { + + } + + @Override + public void printf(Level level, String format, Object... params) { + + } + + @Override + public T throwing(Level level, T throwable) { + return null; + } + + @Override + public T throwing(T throwable) { + return null; + } + + @Override + public void trace(Marker marker, Message message) { + + } + + @Override + public void trace(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void trace(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, CharSequence message) { + + } + + @Override + public void trace(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, Object message) { + + } + + @Override + public void trace(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, String message) { + + } + + @Override + public void trace(Marker marker, String message, Object... params) { + + } + + @Override + public void trace(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void trace(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void trace(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void trace(Message message) { + + } + + @Override + public void trace(Message message, Throwable throwable) { + + } + + @Override + public void trace(MessageSupplier messageSupplier) { + + } + + @Override + public void trace(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void trace(CharSequence message) { + + } + + @Override + public void trace(CharSequence message, Throwable throwable) { + + } + + @Override + public void trace(Object message) { + + } + + @Override + public void trace(Object message, Throwable throwable) { + + } + + @Override + public void trace(String message) { + + } + + @Override + public void trace(String message, Object... params) { + + } + + @Override + public void trace(String message, Supplier... paramSuppliers) { + + } + + @Override + public void trace(String message, Throwable throwable) { + + } + + @Override + public void trace(Supplier messageSupplier) { + + } + + @Override + public void trace(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void trace(Marker marker, String message, Object p0) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void trace(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void trace(String message, Object p0) { + + } + + @Override + public void trace(String message, Object p0, Object p1) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void trace(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public EntryMessage traceEntry() { + return null; + } + + @Override + public EntryMessage traceEntry(String format, Object... params) { + return null; + } + + @Override + public EntryMessage traceEntry(Supplier... paramSuppliers) { + return null; + } + + @Override + public EntryMessage traceEntry(String format, Supplier... paramSuppliers) { + return null; + } + + @Override + public EntryMessage traceEntry(Message message) { + return null; + } + + @Override + public void traceExit() { + + } + + @Override + public R traceExit(R result) { + return null; + } + + @Override + public R traceExit(String format, R result) { + return null; + } + + @Override + public void traceExit(EntryMessage message) { + + } + + @Override + public R traceExit(EntryMessage message, R result) { + return null; + } + + @Override + public R traceExit(Message message, R result) { + return null; + } + + @Override + public void warn(Marker marker, Message message) { + + } + + @Override + public void warn(Marker marker, Message message, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, MessageSupplier messageSupplier) { + + } + + @Override + public void warn(Marker marker, MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, CharSequence message) { + + } + + @Override + public void warn(Marker marker, CharSequence message, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, Object message) { + + } + + @Override + public void warn(Marker marker, Object message, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, String message) { + + } + + @Override + public void warn(Marker marker, String message, Object... params) { + + } + + @Override + public void warn(Marker marker, String message, Supplier... paramSuppliers) { + + } + + @Override + public void warn(Marker marker, String message, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, Supplier messageSupplier) { + + } + + @Override + public void warn(Marker marker, Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void warn(Message message) { + + } + + @Override + public void warn(Message message, Throwable throwable) { + + } + + @Override + public void warn(MessageSupplier messageSupplier) { + + } + + @Override + public void warn(MessageSupplier messageSupplier, Throwable throwable) { + + } + + @Override + public void warn(CharSequence message) { + + } + + @Override + public void warn(CharSequence message, Throwable throwable) { + + } + + @Override + public void warn(Object message) { + + } + + @Override + public void warn(Object message, Throwable throwable) { + + } + + @Override + public void warn(String message) { + + } + + @Override + public void warn(String message, Object... params) { + + } + + @Override + public void warn(String message, Supplier... paramSuppliers) { + + } + + @Override + public void warn(String message, Throwable throwable) { + + } + + @Override + public void warn(Supplier messageSupplier) { + + } + + @Override + public void warn(Supplier messageSupplier, Throwable throwable) { + + } + + @Override + public void warn(Marker marker, String message, Object p0) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void warn(Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } + + @Override + public void warn(String message, Object p0) { + + } + + @Override + public void warn(String message, Object p0, Object p1) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { + + } + + @Override + public void warn(String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { + + } +} diff --git a/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java b/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java new file mode 100644 index 000000000..e89587690 --- /dev/null +++ b/src/main/java/org/apache/xmlbeans/impl/logging/XmlBeansLogManager.java @@ -0,0 +1,54 @@ +/* Copyright 2004 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.xmlbeans.impl.logging; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.apache.xmlbeans.impl.util.ExceptionUtil; + +/** + * This class is used to get a log4j logger for the XmlBeans project. + *

Internal use only.

+ *

Fails over to a No-Op logger if there are problems creating log4j logger.

+ * + * @since XmlBeans 5.3.0 + */ +public final class XmlBeansLogManager { + + // Sleep time in milliseconds (10 minutes) + private static final long SLEEP_TIME = 10 * 60 * 1000; + private static long LAST_TIME = System.currentTimeMillis(); + + private XmlBeansLogManager() { + } + + public static Logger getLogger(Class clz) { + try { + return LogManager.getLogger(clz); + } 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."); + t.printStackTrace(); + } + } + return NoOpLogger.INSTANCE; + } + } + +} diff --git a/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java b/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java index 152cc86bf..01bce9b69 100644 --- a/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java +++ b/src/main/java/org/apache/xmlbeans/impl/schema/StscJavaizer.java @@ -15,10 +15,10 @@ package org.apache.xmlbeans.impl.schema; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.*; import org.apache.xmlbeans.impl.common.NameUtil; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import javax.xml.namespace.QName; import java.math.BigInteger; @@ -26,7 +26,7 @@ public class StscJavaizer { - private static final Logger LOG = LogManager.getLogger(StscJavaizer.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(StscJavaizer.class); /** * XMLBEANS-307 diff --git a/src/main/java/org/apache/xmlbeans/impl/store/Locale.java b/src/main/java/org/apache/xmlbeans/impl/store/Locale.java index 03e28c3cc..ac61ac2e7 100755 --- a/src/main/java/org/apache/xmlbeans/impl/store/Locale.java +++ b/src/main/java/org/apache/xmlbeans/impl/store/Locale.java @@ -15,7 +15,6 @@ package org.apache.xmlbeans.impl.store; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.*; import org.apache.xmlbeans.XmlCursor.XmlBookmark; @@ -23,6 +22,7 @@ import org.apache.xmlbeans.impl.common.ResolverUtil; import org.apache.xmlbeans.impl.common.SAXHelper; import org.apache.xmlbeans.impl.common.XmlLocale; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import org.apache.xmlbeans.impl.store.Cur.Locations; import org.apache.xmlbeans.impl.store.DomImpl.Dom; import org.apache.xmlbeans.impl.store.Saaj.SaajCallback; @@ -53,7 +53,7 @@ @SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public final class Locale implements DOMImplementation, SaajCallback, XmlLocale { - private static final Logger LOG = LogManager.getLogger(Locale.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(Locale.class); static final int ROOT = Cur.ROOT; static final int ELEM = Cur.ELEM; diff --git a/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java index 61d330f31..03cd5254e 100644 --- a/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java +++ b/src/main/java/org/apache/xmlbeans/impl/tool/MavenPluginResolver.java @@ -29,7 +29,7 @@ public static EntityResolver getResolver(String catalogLocation) { if (catalogLocation == null) { return null; } - CatalogManager catalogManager = CatalogManager.getStaticManager(); + CatalogManager catalogManager = CataXmlBeansLogManager.getStaticManager(); catalogManager.setCatalogFiles(catalogLocation); return new CatalogResolver(catalogManager); } diff --git a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java index 043c8b06d..ef73cb4a7 100644 --- a/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java +++ b/src/main/java/org/apache/xmlbeans/impl/xpath/saxon/SaxonXQuery.java @@ -29,9 +29,9 @@ import net.sf.saxon.str.StringView; import net.sf.saxon.type.BuiltInAtomicType; import net.sf.saxon.value.*; -import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.xmlbeans.*; +import org.apache.xmlbeans.impl.logging.XmlBeansLogManager; import org.apache.xmlbeans.impl.store.Cur; import org.apache.xmlbeans.impl.store.Cursor; import org.apache.xmlbeans.impl.store.Locale; @@ -54,7 +54,7 @@ import java.util.Map; public class SaxonXQuery implements XQuery { - private static final Logger LOG = LogManager.getLogger(SaxonXQuery.class); + private static final Logger LOG = XmlBeansLogManager.getLogger(SaxonXQuery.class); private final XQueryExpression xquery; private final String contextVar;