This is an automated email from the ASF dual-hosted git repository. joewitt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push: new 19b4be40aa NIFI-12157 This closes #7826. Removed nifi-logging-utils and NiFiLog - Replaced NiFiLog references with direct references to SLF4J LoggerFactory 19b4be40aa is described below commit 19b4be40aa84b01eed4437658ccfab6b4d32ce51 Author: exceptionfactory <exceptionfact...@apache.org> AuthorDate: Sat Sep 30 20:26:40 2023 -0500 NIFI-12157 This closes #7826. Removed nifi-logging-utils and NiFiLog - Replaced NiFiLog references with direct references to SLF4J LoggerFactory Signed-off-by: Joseph Witt <joew...@apache.org> --- minifi/pom.xml | 5 - nifi-commons/nifi-logging-utils/pom.xml | 31 -- .../main/java/org/apache/nifi/logging/NiFiLog.java | 366 --------------------- nifi-commons/nifi-socket-utils/pom.xml | 5 - .../org/apache/nifi/io/socket/SocketUtils.java | 7 +- nifi-commons/pom.xml | 1 - .../nifi-framework-cluster-protocol/pom.xml | 5 - .../nifi-framework/nifi-framework-cluster/pom.xml | 4 - .../impl/FileBasedClusterNodeFirewall.java | 6 +- .../nifi-framework/nifi-framework-core/pom.xml | 5 - .../apache/nifi/web/util/ClientResponseUtils.java | 5 +- .../web/security/requests/ContentLengthFilter.java | 3 +- nifi-nar-bundles/nifi-framework-bundle/pom.xml | 5 - 13 files changed, 8 insertions(+), 440 deletions(-) diff --git a/minifi/pom.xml b/minifi/pom.xml index 6c3a464aca..8121282e03 100644 --- a/minifi/pom.xml +++ b/minifi/pom.xml @@ -365,11 +365,6 @@ limitations under the License. <artifactId>nifi-xml-processing</artifactId> <version>2.0.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-nar-utils</artifactId> diff --git a/nifi-commons/nifi-logging-utils/pom.xml b/nifi-commons/nifi-logging-utils/pom.xml deleted file mode 100644 index 62b9276879..0000000000 --- a/nifi-commons/nifi-logging-utils/pom.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You 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. ---> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-commons</artifactId> - <version>2.0.0-SNAPSHOT</version> - </parent> - <artifactId>nifi-logging-utils</artifactId> - <description>Utilities for logging</description> - <dependencies> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - </dependencies> -</project> diff --git a/nifi-commons/nifi-logging-utils/src/main/java/org/apache/nifi/logging/NiFiLog.java b/nifi-commons/nifi-logging-utils/src/main/java/org/apache/nifi/logging/NiFiLog.java deleted file mode 100644 index 8f6f1d954f..0000000000 --- a/nifi-commons/nifi-logging-utils/src/main/java/org/apache/nifi/logging/NiFiLog.java +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.nifi.logging; - -import org.slf4j.Logger; -import org.slf4j.Marker; - -/** - * - */ -public class NiFiLog implements Logger { - - private final Logger logger; - - public NiFiLog(final Logger logger) { - this.logger = logger; - } - - public Logger getWrappedLog() { - return logger; - } - - @Override - public void warn(Marker marker, String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.warn(marker, string, thrwbl); - } else { - logger.warn(marker, string); - } - } - - @Override - public void warn(Marker marker, String string, Object... os) { - logger.warn(marker, string, os); - } - - @Override - public void warn(Marker marker, String string, Object o, Object o1) { - logger.warn(marker, string, o, o1); - } - - @Override - public void warn(Marker marker, String string, Object o) { - logger.warn(marker, string, o); - } - - @Override - public void warn(Marker marker, String string) { - logger.warn(marker, string); - } - - @Override - public void warn(String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.warn(string, thrwbl); - } else { - logger.warn(string); - } - } - - @Override - public void warn(String string, Object o, Object o1) { - logger.warn(string, o, o1); - } - - @Override - public void warn(String string, Object... os) { - logger.warn(string, os); - } - - @Override - public void warn(String string, Object o) { - logger.warn(string, o); - } - - @Override - public void warn(String string) { - logger.warn(string); - } - - @Override - public void trace(Marker marker, String string, Throwable thrwbl) { - logger.trace(marker, string, thrwbl); - } - - @Override - public void trace(Marker marker, String string, Object... os) { - logger.trace(marker, string, os); - } - - @Override - public void trace(Marker marker, String string, Object o, Object o1) { - logger.trace(marker, string, o, o1); - } - - @Override - public void trace(Marker marker, String string, Object o) { - logger.trace(marker, string, o); - } - - @Override - public void trace(Marker marker, String string) { - logger.trace(marker, string); - } - - @Override - public void trace(String string, Throwable thrwbl) { - logger.trace(string, thrwbl); - } - - @Override - public void trace(String string, Object... os) { - logger.trace(string, os); - } - - @Override - public void trace(String string, Object o, Object o1) { - logger.trace(string, o, o1); - } - - @Override - public void trace(String string, Object o) { - logger.trace(string, o); - } - - @Override - public void trace(String string) { - logger.trace(string); - } - - @Override - public boolean isWarnEnabled(Marker marker) { - return logger.isWarnEnabled(marker); - } - - @Override - public boolean isWarnEnabled() { - return logger.isWarnEnabled(); - } - - @Override - public boolean isTraceEnabled(Marker marker) { - return logger.isTraceEnabled(marker); - } - - @Override - public boolean isTraceEnabled() { - return logger.isTraceEnabled(); - } - - @Override - public boolean isInfoEnabled(Marker marker) { - return logger.isInfoEnabled(marker); - } - - @Override - public boolean isInfoEnabled() { - return logger.isInfoEnabled(); - } - - @Override - public boolean isErrorEnabled(Marker marker) { - return logger.isErrorEnabled(marker); - } - - @Override - public boolean isErrorEnabled() { - return logger.isErrorEnabled(); - } - - @Override - public boolean isDebugEnabled(Marker marker) { - return logger.isDebugEnabled(marker); - } - - @Override - public boolean isDebugEnabled() { - return logger.isDebugEnabled(); - } - - @Override - public void info(Marker marker, String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.info(marker, string, thrwbl); - } else { - logger.info(marker, string); - } - } - - @Override - public void info(Marker marker, String string, Object... os) { - logger.info(marker, string, os); - } - - @Override - public void info(Marker marker, String string, Object o, Object o1) { - logger.info(marker, string, o, o1); - } - - @Override - public void info(Marker marker, String string, Object o) { - logger.info(marker, string, o); - } - - @Override - public void info(Marker marker, String string) { - logger.info(marker, string); - } - - @Override - public void info(String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.info(string, thrwbl); - } else { - logger.info(string); - } - } - - @Override - public void info(String string, Object... os) { - logger.info(string, os); - } - - @Override - public void info(String string, Object o, Object o1) { - logger.info(string, o, o1); - } - - @Override - public void info(String string, Object o) { - logger.info(string, o); - } - - @Override - public void info(String string) { - logger.info(string); - } - - @Override - public String getName() { - return logger.getName(); - } - - @Override - public void error(Marker marker, String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.error(marker, string, thrwbl); - } else { - logger.error(marker, string); - } - } - - @Override - public void error(Marker marker, String string, Object... os) { - logger.error(marker, string, os); - } - - @Override - public void error(Marker marker, String string, Object o, Object o1) { - logger.error(marker, string, o, o1); - } - - @Override - public void error(Marker marker, String string, Object o) { - logger.error(marker, string, o); - } - - @Override - public void error(Marker marker, String string) { - logger.error(marker, string); - } - - @Override - public void error(String string, Throwable thrwbl) { - if (logger.isDebugEnabled()) { - logger.error(string, thrwbl); - } else { - logger.error(string); - } - } - - @Override - public void error(String string, Object... os) { - logger.error(string, os); - } - - @Override - public void error(String string, Object o, Object o1) { - logger.error(string, o, o1); - } - - @Override - public void error(String string, Object o) { - logger.error(string, o); - } - - @Override - public void error(String string) { - logger.error(string); - } - - @Override - public void debug(Marker marker, String string, Throwable thrwbl) { - logger.debug(marker, string, thrwbl); - } - - @Override - public void debug(Marker marker, String string, Object... os) { - logger.debug(marker, string, os); - } - - @Override - public void debug(Marker marker, String string, Object o, Object o1) { - logger.debug(marker, string, o, o1); - } - - @Override - public void debug(Marker marker, String string, Object o) { - logger.debug(marker, string, o); - } - - @Override - public void debug(Marker marker, String string) { - logger.debug(marker, string); - } - - @Override - public void debug(String string, Throwable thrwbl) { - logger.debug(string, thrwbl); - } - - @Override - public void debug(String string, Object... os) { - logger.debug(string, os); - } - - @Override - public void debug(String string, Object o, Object o1) { - logger.debug(string, o, o1); - } - - @Override - public void debug(String string, Object o) { - logger.debug(string, o); - } - - @Override - public void debug(String string) { - logger.debug(string); - } - -} diff --git a/nifi-commons/nifi-socket-utils/pom.xml b/nifi-commons/nifi-socket-utils/pom.xml index 05f6ec0f6b..2d7829128c 100644 --- a/nifi-commons/nifi-socket-utils/pom.xml +++ b/nifi-commons/nifi-socket-utils/pom.xml @@ -37,11 +37,6 @@ <artifactId>nifi-security-utils-api</artifactId> <version>2.0.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> diff --git a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketUtils.java b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketUtils.java index 1cea9faa07..f2ff08d9a3 100644 --- a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketUtils.java +++ b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketUtils.java @@ -25,7 +25,6 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLException; import javax.net.ssl.SSLServerSocket; import javax.net.ssl.SSLSocket; -import org.apache.nifi.logging.NiFiLog; import org.apache.nifi.security.util.TlsException; import org.apache.nifi.security.util.TlsPlatform; import org.slf4j.Logger; @@ -33,7 +32,7 @@ import org.slf4j.LoggerFactory; public final class SocketUtils { - private static final Logger logger = new NiFiLog(LoggerFactory.getLogger(SocketUtils.class)); + private static final Logger logger = LoggerFactory.getLogger(SocketUtils.class); /** * Returns a {@link Socket} (effectively used as a client socket) for the given address and configuration. @@ -171,7 +170,7 @@ public final class SocketUtils { } } } catch (final Exception ex) { - logger.debug("Failed to close socket due to: " + ex, ex); + logger.debug("Failed to close socket", ex); } } @@ -183,7 +182,7 @@ public final class SocketUtils { try { serverSocket.close(); } catch (final Exception ex) { - logger.debug("Failed to close server socket due to: " + ex, ex); + logger.debug("Failed to close server socket", ex); } } diff --git a/nifi-commons/pom.xml b/nifi-commons/pom.xml index 2e26b83334..cbb2bfb5ee 100644 --- a/nifi-commons/pom.xml +++ b/nifi-commons/pom.xml @@ -33,7 +33,6 @@ <module>nifi-json-utils</module> <module>nifi-jetty-configuration</module> <module>nifi-kubernetes-client</module> - <module>nifi-logging-utils</module> <module>nifi-metrics</module> <module>nifi-parameter</module> <module>nifi-per-process-group-logging</module> diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/pom.xml index c17cb557ce..9a55f00d40 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/pom.xml @@ -33,11 +33,6 @@ <groupId>org.apache.nifi</groupId> <artifactId>nifi-properties</artifactId> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-socket-utils</artifactId> diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml index 820373bfd9..b325f70865 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/pom.xml @@ -33,10 +33,6 @@ <groupId>org.apache.nifi</groupId> <artifactId>nifi-properties</artifactId> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - </dependency> <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-utils</artifactId> diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewall.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewall.java index d8e9b07dd4..90679753da 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewall.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/firewall/impl/FileBasedClusterNodeFirewall.java @@ -27,7 +27,6 @@ import java.util.Collection; import org.apache.commons.net.util.SubnetUtils; import org.apache.nifi.cluster.firewall.ClusterNodeFirewall; -import org.apache.nifi.logging.NiFiLog; import org.apache.nifi.util.file.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +55,7 @@ public class FileBasedClusterNodeFirewall implements ClusterNodeFirewall { private final Collection<SubnetUtils.SubnetInfo> subnetInfos = new ArrayList<>(); - private static final Logger logger = new NiFiLog(LoggerFactory.getLogger(FileBasedClusterNodeFirewall.class)); + private static final Logger logger = LoggerFactory.getLogger(FileBasedClusterNodeFirewall.class); public FileBasedClusterNodeFirewall(final File config) throws IOException { this(config, null); @@ -84,7 +83,6 @@ public class FileBasedClusterNodeFirewall implements ClusterNodeFirewall { throw new IOException("Firewall configuration file did not exist and could not be created: " + config.getAbsolutePath()); } - logger.info("Loading cluster firewall configuration."); parseConfig(config); logger.info("Cluster firewall configuration loaded."); } @@ -102,7 +100,7 @@ public class FileBasedClusterNodeFirewall implements ClusterNodeFirewall { try { ip = InetAddress.getByName(hostOrIp).getHostAddress(); } catch (final UnknownHostException uhe) { - logger.warn("Blocking unknown host '{}'", hostOrIp, uhe); + logger.warn("Blocking unknown host '{}'", hostOrIp); return false; } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml index 41ee9b0bcf..c39a8f984e 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml @@ -129,11 +129,6 @@ <groupId>org.apache.nifi</groupId> <artifactId>nifi-framework-cluster-protocol</artifactId> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-client-dto</artifactId> diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/ClientResponseUtils.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/ClientResponseUtils.java index 5f49bf87fd..6bcd0a6fd2 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/ClientResponseUtils.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/util/ClientResponseUtils.java @@ -17,7 +17,6 @@ package org.apache.nifi.web.util; import org.apache.commons.io.IOUtils; -import org.apache.nifi.logging.NiFiLog; import org.apache.nifi.stream.io.NullOutputStream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,7 +31,7 @@ import java.io.InputStream; */ public class ClientResponseUtils { - private static final Logger logger = new NiFiLog(LoggerFactory.getLogger(ClientResponseUtils.class)); + private static final Logger logger = LoggerFactory.getLogger(ClientResponseUtils.class); public static void drainClientResponse(final Response response) { if (response != null) { @@ -41,7 +40,7 @@ public class ClientResponseUtils { bis = new BufferedInputStream(response.readEntity(InputStream.class)); IOUtils.copy(bis, new NullOutputStream()); } catch (final IOException ioe) { - logger.info("Failed clearing out non-client response buffer due to: " + ioe, ioe); + logger.warn("Failed clearing out non-client response buffer", ioe); } finally { IOUtils.closeQuietly(bis); } diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java index 10aa4532dc..576edd3bbb 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java @@ -30,14 +30,13 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; import javax.servlet.http.HttpServletResponse; -import org.apache.nifi.logging.NiFiLog; import org.apache.nifi.util.FormatUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ContentLengthFilter implements Filter { - private static final Logger logger = new NiFiLog(LoggerFactory.getLogger(ContentLengthFilter.class)); + private static final Logger logger = LoggerFactory.getLogger(ContentLengthFilter.class); public final static String MAX_LENGTH_INIT_PARAM = "maxContentLength"; public final static int MAX_LENGTH_DEFAULT = 10_000_000; private int maxContentLength; diff --git a/nifi-nar-bundles/nifi-framework-bundle/pom.xml b/nifi-nar-bundles/nifi-framework-bundle/pom.xml index 93cf03d92f..5eb80b8eb8 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/pom.xml +++ b/nifi-nar-bundles/nifi-framework-bundle/pom.xml @@ -106,11 +106,6 @@ <artifactId>nifi-site-to-site-client</artifactId> <version>2.0.0-SNAPSHOT</version> </dependency> - <dependency> - <groupId>org.apache.nifi</groupId> - <artifactId>nifi-logging-utils</artifactId> - <version>2.0.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>org.apache.nifi</groupId> <artifactId>nifi-utils</artifactId>