This is an automated email from the ASF dual-hosted git repository. exceptionfactory 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 b3fac8c80b NIFI-13403 Removed unnecessary toString in logging statements b3fac8c80b is described below commit b3fac8c80b94b829f89504adfeb892b08e083fd2 Author: dan-s1 <dsti...@gmail.com> AuthorDate: Wed Jun 19 21:53:31 2024 +0000 NIFI-13403 Removed unnecessary toString in logging statements This closes #8984 Signed-off-by: David Handermann <exceptionfact...@apache.org> --- .../minifi/bootstrap/command/FlowStatusRunner.java | 2 +- .../main/java/org/apache/nifi/minifi/MiNiFi.java | 3 +- .../nifi/minifi/bootstrap/BootstrapListener.java | 2 +- .../apache/nifi/remote/client/PeerSelector.java | 2 +- .../apache/nifi/wali/LengthDelimitedJournal.java | 2 +- .../ElasticSearchClientServiceImpl.java | 4 +- .../nifi/json/AbstractJsonRowRecordReader.java | 2 +- .../java/org/apache/nifi/json/WriteJsonResult.java | 2 +- ...bstractGetGcpVisionAnnotateOperationStatus.java | 2 +- .../processors/graph/util/InMemoryGraphClient.java | 2 +- .../apache/nifi/graph/TinkerpopClientService.java | 4 +- .../org/apache/nifi/hbase/DeleteHBaseCells.java | 2 +- .../java/org/apache/nifi/hbase/PutHBaseJSON.java | 2 +- .../apache/nifi/provenance/IndexConfiguration.java | 3 +- .../provenance/index/lucene/LuceneEventIndex.java | 3 +- .../provenance/lucene/StandardIndexManager.java | 4 +- .../provenance/store/WriteAheadStorePartition.java | 2 +- .../apache/nifi/questdb/embedded/LockedClient.java | 2 +- .../embedded/TableWriterBasedInsertRowContext.java | 2 +- .../nifi/processors/standard/ConvertJSONToSQL.java | 4 +- .../apache/nifi/processors/standard/FetchFile.java | 2 +- .../apache/nifi/processors/standard/ListFile.java | 4 +- .../nifi/processors/standard/ReplaceText.java | 6 +-- .../apache/nifi/processors/standard/TailFile.java | 2 +- .../nifi/processors/standard/ValidateRecord.java | 2 +- .../nifi/processors/standard/util/FTPTransfer.java | 2 +- .../processors/standard/util/SFTPTransfer.java | 4 +- .../controller/ControllerStatusReportingTask.java | 6 +-- .../apache/nifi/record/sink/LoggingRecordSink.java | 2 +- .../heartbeat/AbstractHeartbeatMonitor.java | 6 +-- .../replication/StandardAsyncClusterResponse.java | 2 +- .../replication/ThreadPoolRequestReplicator.java | 5 +-- .../flowanalysis/AbstractFlowAnalysisRuleNode.java | 2 +- .../repository/StandardProcessSession.java | 4 +- .../logging/repository/StandardLogRepository.java | 2 +- .../nifi/remote/StandardRemoteProcessGroup.java | 8 +--- .../apache/nifi/controller/ExtensionBuilder.java | 2 +- .../org/apache/nifi/controller/FlowController.java | 5 +-- .../controller/queue/SwappablePriorityQueue.java | 9 ++--- .../async/nio/NioAsyncLoadBalanceClient.java | 2 +- .../repository/FileSystemRepository.java | 44 +++++----------------- .../scheduling/StandardProcessScheduler.java | 3 +- .../serialization/VersionedFlowSynchronizer.java | 2 +- .../local/WriteAheadLocalStateProvider.java | 3 +- .../nifi/controller/tasks/ConnectableTask.java | 5 +-- .../nifi/controller/tasks/ExpireFlowFiles.java | 2 +- .../nifi/diagnostics/SystemDiagnosticsFactory.java | 15 ++------ .../nar/StandardExtensionDiscoveringManager.java | 2 +- .../zookeeper/CuratorLeaderElectionManager.java | 11 +----- .../src/main/java/org/apache/nifi/NiFi.java | 4 +- .../nifi/remote/SocketRemoteSiteListener.java | 29 ++++---------- .../nifi/remote/StandardRemoteGroupPort.java | 5 +-- .../apache/nifi/web/api/dto/DtoFactoryTest.java | 4 +- .../security/x509/X509AuthenticationProvider.java | 2 +- .../provider/flow/git/GitFlowMetaData.java | 2 +- .../provider/hook/LoggingEventHookProvider.java | 2 +- .../web/security/NiFiRegistrySecurityConfig.java | 2 +- .../nifi/stateless/bootstrap/RunStatelessFlow.java | 2 +- .../controller/reporting/LogComponentStatuses.java | 4 +- .../stateless/session/StatelessProcessSession.java | 2 +- 60 files changed, 96 insertions(+), 177 deletions(-) diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/FlowStatusRunner.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/FlowStatusRunner.java index 000faedf8e..b3c313ddc9 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/FlowStatusRunner.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/FlowStatusRunner.java @@ -39,7 +39,7 @@ public class FlowStatusRunner implements CommandRunner { @Override public int runCommand(String[] args) { if (args.length == 2) { - CMD_LOGGER.info(periodicStatusReporterManager.statusReport(args[1]).toString()); + CMD_LOGGER.info("{}", periodicStatusReporterManager.statusReport(args[1])); return OK.getStatusCode(); } else { CMD_LOGGER.error("The 'flowStatus' command requires an input query. See the System Admin Guide 'FlowStatus Script Query' section for complete details."); diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/MiNiFi.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/MiNiFi.java index 76419a3666..c35957709f 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/MiNiFi.java +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/MiNiFi.java @@ -74,8 +74,7 @@ public class MiNiFi { } Thread.setDefaultUncaughtExceptionHandler((t, e) -> { - logger.error("An Unknown Error Occurred in Thread {}: {}", t, e.toString()); - logger.error("", e); + logger.error("An Unknown Error Occurred in Thread {}", t, e); }); // register the shutdown hook diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/bootstrap/BootstrapListener.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/bootstrap/BootstrapListener.java index afdc9b7d01..545190416a 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/bootstrap/BootstrapListener.java +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-runtime/src/main/java/org/apache/nifi/minifi/bootstrap/BootstrapListener.java @@ -257,7 +257,7 @@ public class BootstrapListener implements BootstrapCommunicator { try { socket.close(); } catch (IOException ioe) { - logger.warn("Failed to close socket to Bootstrap due to {}", ioe.toString()); + logger.warn("Failed to close socket to Bootstrap", ioe); } } } diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java index d2bc89d304..710fd27460 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/PeerSelector.java @@ -201,7 +201,7 @@ public class PeerSelector { .append(" will").append(direction == TransferDirection.RECEIVE ? " send " : " receive ") .append(df.format(percentage)).append("% of data"); } - logger.debug(distributionDescription.toString()); + logger.debug("{}", distributionDescription); } } diff --git a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java index a0c403074b..61af2b0c32 100644 --- a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java +++ b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/LengthDelimitedJournal.java @@ -175,7 +175,7 @@ public class LengthDelimitedJournal<T> implements WriteAheadJournal<T> { poison(t); final IOException ioe = (t instanceof IOException) ? (IOException) t : new IOException("Failed to create journal file " + journalFile, t); - logger.error("Failed to create new journal file {} due to {}", journalFile, ioe.toString(), ioe); + logger.error("Failed to create new journal file {}", journalFile, ioe); throw ioe; } diff --git a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java index e94a12b860..e2be33465e 100644 --- a/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java +++ b/nifi-extension-bundles/nifi-elasticsearch-bundle/nifi-elasticsearch-client-service/src/main/java/org/apache/nifi/elasticsearch/ElasticSearchClientServiceImpl.java @@ -668,7 +668,7 @@ public class ElasticSearchClientServiceImpl extends AbstractControllerService im } if (getLogger().isDebugEnabled()) { - getLogger().debug(payload.toString()); + getLogger().debug("{}", payload); } final HttpEntity entity = new NStringEntity(payload.toString(), ContentType.APPLICATION_JSON); final StopWatch watch = new StopWatch(); @@ -1030,7 +1030,7 @@ public class ElasticSearchClientServiceImpl extends AbstractControllerService im .append("\n"); } - getLogger().debug(builder.toString()); + getLogger().debug("{}", builder); } return client.performRequest(request); diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java index d213e6ab36..b35d1ca301 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/AbstractJsonRowRecordReader.java @@ -178,7 +178,7 @@ public abstract class AbstractJsonRowRecordReader implements RecordReader { } catch (final MalformedRecordException mre) { throw mre; } catch (final Exception e) { - logger.debug("Failed to convert JSON Element {} into a Record object using schema {} due to {}", nextNode, schema, e.toString(), e); + logger.debug("Failed to convert JSON Element {} into a Record object using schema {}", nextNode, schema, e); throw new MalformedRecordException("Successfully parsed a JSON object from input but failed to convert into a Record object with the given schema", e); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/WriteJsonResult.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/WriteJsonResult.java index 11408f237f..9155b5f954 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/WriteJsonResult.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-json-record-utils/src/main/java/org/apache/nifi/json/WriteJsonResult.java @@ -250,7 +250,7 @@ public class WriteJsonResult extends AbstractRecordSetWriter implements RecordSe endTask.apply(generator); } catch (final Exception e) { - logger.error("Failed to write {} with reader schema {} and writer schema {} as a JSON Object due to {}", record, record.getSchema(), writeSchema, e.toString(), e); + logger.error("Failed to write {} with reader schema {} and writer schema {} as a JSON Object", record, record.getSchema(), writeSchema, e); throw e; } } diff --git a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java index 0a8db05d75..c5d589d2d1 100644 --- a/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java +++ b/nifi-extension-bundles/nifi-gcp-bundle/nifi-gcp-processors/src/main/java/org/apache/nifi/processors/gcp/vision/AbstractGetGcpVisionAnnotateOperationStatus.java @@ -89,7 +89,7 @@ abstract public class AbstractGetGcpVisionAnnotateOperationStatus extends Abstra try { String operationKey = context.getProperty(OPERATION_KEY).evaluateAttributeExpressions(flowFile).getValue();; Operation operation = getVisionClient().getOperationsClient().getOperation(operationKey); - getLogger().info(operation.toString()); + getLogger().info("{}", operation); if (operation.getDone() && !operation.hasError()) { GeneratedMessageV3 response = deserializeResponse(operation.getResponse().getValue()); FlowFile childFlowFile = session.create(flowFile); diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/test/java/org/apache/nifi/processors/graph/util/InMemoryGraphClient.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/test/java/org/apache/nifi/processors/graph/util/InMemoryGraphClient.java index 6894454142..d8cc163443 100644 --- a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/test/java/org/apache/nifi/processors/graph/util/InMemoryGraphClient.java +++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/test/java/org/apache/nifi/processors/graph/util/InMemoryGraphClient.java @@ -98,7 +98,7 @@ public class InMemoryGraphClient extends AbstractControllerService implements Gr Map<String, Object> resultReturnMap = new HashMap<>(); resultReturnMap.put(innerResultSet.getKey(), returnObject); if (getLogger().isDebugEnabled()) { - getLogger().debug(resultReturnMap.toString()); + getLogger().debug("{}", resultReturnMap); } // return the object to the graphQueryResultCallback object graphQueryResultCallback.process(resultReturnMap, resultSet.hasNext()); diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java index 4ce288e306..7814c9fc67 100644 --- a/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java +++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-other-graph-services/src/main/java/org/apache/nifi/graph/TinkerpopClientService.java @@ -466,7 +466,7 @@ public class TinkerpopClientService extends AbstractControllerService implements } if (getLogger().isDebugEnabled()) { - getLogger().debug(map.toString()); + getLogger().debug("{}", map); } Binding bindings = new Binding(); @@ -492,7 +492,7 @@ public class TinkerpopClientService extends AbstractControllerService implements Map<String, Object> resultReturnMap = new HashMap<>(); resultReturnMap.put(innerResultSet.getKey(), returnObject); if (getLogger().isDebugEnabled()) { - getLogger().debug(resultReturnMap.toString()); + getLogger().debug("{}", resultReturnMap); } graphQueryResultCallback.process(resultReturnMap, resultSet.hasNext()); } diff --git a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/DeleteHBaseCells.java b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/DeleteHBaseCells.java index 5d0bacd21c..25d2d352dc 100644 --- a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/DeleteHBaseCells.java +++ b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/DeleteHBaseCells.java @@ -84,7 +84,7 @@ public class DeleteHBaseCells extends AbstractDeleteHBase { .append(String.format("Column Family: %s\t", family)) .append(String.format("Column Qualifier: %s\t", column)) .append(String.format("Visibility Label: %s", visibility)); - getLogger().debug(sb.toString()); + getLogger().debug("{}", sb); } @Override diff --git a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java index 4962a51d0d..e628bd86e1 100644 --- a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java +++ b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseJSON.java @@ -189,7 +189,7 @@ public class PutHBaseJSON extends AbstractPutHBase { } }); } catch (final ProcessException pe) { - getLogger().error("Failed to parse {} as JSON due to {}; routing to failure", flowFile, pe.toString(), pe); + getLogger().error("Failed to parse {} as JSON; routing to failure", flowFile, pe); return null; } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java index cb280d4ddb..36cb6aaa5b 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/IndexConfiguration.java @@ -97,8 +97,7 @@ public class IndexConfiguration { } catch (final FileNotFoundException | EOFException fnf) { return null; // file no longer exists or there's no record in this file } catch (final IOException ioe) { - logger.warn("Failed to read first entry in file {} due to {}", provenanceLogFile, ioe.toString()); - logger.warn("", ioe); + logger.warn("Failed to read first entry in file {}", provenanceLogFile, ioe); return null; } } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java index 41bbcffc77..6405ed3980 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneEventIndex.java @@ -901,8 +901,7 @@ public class LuceneEventIndex implements EventIndex { } } } catch (final Exception e) { - logger.error("Failed to expire Provenance Query Results due to {}", e.toString()); - logger.error("", e); + logger.error("Failed to expire Provenance Query Results", e); } } } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/StandardIndexManager.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/StandardIndexManager.java index 65c64a9257..517b203b54 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/StandardIndexManager.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/StandardIndexManager.java @@ -185,7 +185,7 @@ public class StandardIndexManager implements IndexManager { try { close(count); } catch (final Exception e) { - logger.warn("Failed to close Index Writer {} due to {}", count.getWriter(), e.toString(), e); + logger.warn("Failed to close Index Writer {}", count.getWriter(), e); } } } @@ -362,7 +362,7 @@ public class StandardIndexManager implements IndexManager { } } } catch (final Exception e) { - logger.warn("Failed to close Index Writer {} due to {}", writer, e.toString(), e); + logger.warn("Failed to close Index Writer {}", writer, e); } } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/WriteAheadStorePartition.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/WriteAheadStorePartition.java index 1e91a2812c..4c5795a5d7 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/WriteAheadStorePartition.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/WriteAheadStorePartition.java @@ -659,7 +659,7 @@ public class WriteAheadStorePartition implements EventStorePartition { } } catch (final EOFException | FileNotFoundException eof) { // Ran out of data. Continue on. - logger.warn("Failed to find event with ID {} in Event File {} due to {}", minEventIdToReindex, eventFile, eof.toString()); + logger.warn("Failed to find event with ID {} in Event File {}", minEventIdToReindex, eventFile, eof); } catch (final Exception e) { logger.error("Failed to index Provenance Events found in {}", eventFile, e); } diff --git a/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/LockedClient.java b/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/LockedClient.java index 636cd76ddc..3a80a890e1 100644 --- a/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/LockedClient.java +++ b/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/LockedClient.java @@ -69,7 +69,7 @@ final class LockedClient implements Client { } private <R> R lockedOperation(final Callable<R> operation) throws DatabaseException { - LOGGER.debug("Start locking client {}", client.toString()); + LOGGER.debug("Start locking client {}", client); try { if (!lock.tryLock(lockAttemptDuration.toMillis(), TimeUnit.MILLISECONDS)) { throw new LockUnsuccessfulException("Could not lock read lock on the database"); diff --git a/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/TableWriterBasedInsertRowContext.java b/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/TableWriterBasedInsertRowContext.java index e1ed645e52..0b377711b1 100644 --- a/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/TableWriterBasedInsertRowContext.java +++ b/nifi-extension-bundles/nifi-questdb-bundle/nifi-questdb/src/main/java/org/apache/nifi/questdb/embedded/TableWriterBasedInsertRowContext.java @@ -42,7 +42,7 @@ final class TableWriterBasedInsertRowContext implements InsertRowContext { actualRow = null; if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Appending new row to the table writer: {}", actualRow.toString()); + LOGGER.trace("Appending new row to the table writer: {}", actualRow); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ConvertJSONToSQL.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ConvertJSONToSQL.java index 8ba9296db4..d0334869b1 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ConvertJSONToSQL.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ConvertJSONToSQL.java @@ -328,7 +328,7 @@ public class ConvertJSONToSQL extends AbstractProcessor { } }); } catch (ProcessException e) { - getLogger().error("Failed to convert {} into a SQL statement due to {}; routing to failure", flowFile, e.toString(), e); + getLogger().error("Failed to convert {} into a SQL statement", flowFile, e); session.transfer(flowFile, REL_FAILURE); return; } @@ -346,7 +346,7 @@ public class ConvertJSONToSQL extends AbstractProcessor { } }); } catch (final ProcessException pe) { - getLogger().error("Failed to parse {} as JSON due to {}; routing to failure", flowFile, pe.toString(), pe); + getLogger().error("Failed to parse {} as JSON", flowFile, pe); session.transfer(flowFile, REL_FAILURE); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/FetchFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/FetchFile.java index 057cc2fa6b..f9f75b043f 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/FetchFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/FetchFile.java @@ -314,7 +314,7 @@ public class FetchFile extends AbstractProcessor { try (final FileInputStream fis = new FileInputStream(file)) { flowFile = session.importFrom(fis, flowFile); } catch (final IOException | FlowFileAccessException ioe) { - getLogger().error("Could not fetch file {} from file system for {} due to {}; routing to failure", file, flowFile, ioe.toString(), ioe); + getLogger().error("Could not fetch file {} from file system for {}", file, flowFile, ioe); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFile.java index 0c60dd8271..c43126e7d2 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListFile.java @@ -406,7 +406,7 @@ public class ListFile extends AbstractListProcessor<FileInfo> { } } - logger.debug(sb.toString()); + logger.debug("{}", sb); } performanceLoggingTimestamp = System.currentTimeMillis(); @@ -626,7 +626,7 @@ public class ListFile extends AbstractListProcessor<FileInfo> { @Override public FileVisitResult postVisitDirectory(final Path dir, final IOException e) { if (e != null) { - getLogger().error("Error during visiting directory {}: {}", dir.toString(), e.getMessage(), e); + getLogger().error("Error during visiting directory {}", dir, e); } return FileVisitResult.CONTINUE; diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java index 19743d21cc..dcc0cf2b74 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ReplaceText.java @@ -426,14 +426,10 @@ public class ReplaceText extends AbstractProcessor { logger.info("Transferred {} to 'failure'", flowFile, e); session.transfer(flowFile, REL_FAILURE); return; - } catch (BufferOverflowException e) { + } catch (BufferOverflowException | IllegalAttributeException | AttributeExpressionLanguageException e) { logger.warn("Transferred {} to 'failure'", flowFile, e); session.transfer(flowFile, REL_FAILURE); return; - } catch (IllegalAttributeException | AttributeExpressionLanguageException e) { - logger.warn("Transferred {} to 'failure' due to {}", flowFile, e.toString(), e); - session.transfer(flowFile, REL_FAILURE); - return; } logger.info("Transferred {} to 'success'", flowFile); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java index 3317356fea..4044c25d40 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java @@ -799,7 +799,7 @@ public class TailFile extends AbstractProcessor { cleanup(context); tfo.setState(new TailFileState(filename, file, fileChannel, position, timestamp, file.length(), checksum, tfo.getState().getBuffer())); } catch (final IOException ioe) { - getLogger().error("Attempted to position Reader at current position in file {} but failed to do so due to {}", file, ioe.toString(), ioe); + getLogger().error("Attempted to position Reader at current position in file {} but failed to do so", file, ioe); context.yield(); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java index 672399dd0f..cd34f1433b 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateRecord.java @@ -522,7 +522,7 @@ public class ValidateRecord extends AbstractProcessor { sb.append(error).append("\n"); } - getLogger().debug(sb.toString()); + getLogger().debug("{}", sb); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java index f1d03ff403..b19e4f2488 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java @@ -185,7 +185,7 @@ public class FTPTransfer implements FileTransfer { client.disconnect(); } } catch (final Exception ex) { - logger.warn("Failed to close FTPClient due to {}", ex.toString(), ex); + logger.warn("Failed to close FTPClient", ex); } client = null; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java index ac81b836bf..49212fa874 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java @@ -673,7 +673,7 @@ public class SFTPTransfer implements FileTransfer { sftpClient.close(); } } catch (final Exception ex) { - logger.warn("Failed to close SFTPClient due to {}", ex.toString(), ex); + logger.warn("Failed to close SFTPClient", ex); } sftpClient = null; @@ -682,7 +682,7 @@ public class SFTPTransfer implements FileTransfer { sshClient.disconnect(); } } catch (final Exception ex) { - logger.warn("Failed to close SSHClient due to {}", ex.toString(), ex); + logger.warn("Failed to close SSHClient", ex); } sshClient = null; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java index f2e0326315..30f56d1fee 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-reporting-tasks/src/main/java/org/apache/nifi/controller/ControllerStatusReportingTask.java @@ -164,7 +164,7 @@ public class ControllerStatusReportingTask extends AbstractReportingTask { printProcessorStatus(controllerStatus, builder, showDeltas, divisor); builder.append(processorBorderLine); - processorLogger.info(builder.toString()); + processorLogger.info("{}", builder); } private void printConnectionStatuses(final ProcessGroupStatus controllerStatus, final boolean showDeltas, final long divisor) { @@ -180,7 +180,7 @@ public class ControllerStatusReportingTask extends AbstractReportingTask { printConnectionStatus(controllerStatus, builder, showDeltas, divisor); builder.append(connectionBorderLine); - connectionLogger.info(builder.toString()); + connectionLogger.info("{}", builder); } private void printCounters(final ProcessGroupStatus controllerStatus, final boolean showDeltas, final long divisor) { @@ -196,7 +196,7 @@ public class ControllerStatusReportingTask extends AbstractReportingTask { printCounterStatus(controllerStatus, builder, showDeltas, divisor); builder.append(counterBorderLine); - counterLogger.info(builder.toString()); + counterLogger.info("{}", builder); } private void printCounterStatus(final ProcessGroupStatus status, final StringBuilder builder, final boolean showDeltas, final long divisor) { diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/LoggingRecordSink.java b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/LoggingRecordSink.java index 1abea61228..379bbab68e 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/LoggingRecordSink.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-record-sink-service-bundle/nifi-record-sink-service/src/main/java/org/apache/nifi/record/sink/LoggingRecordSink.java @@ -89,7 +89,7 @@ public class LoggingRecordSink extends AbstractControllerService implements Reco baos.reset(); writer.write(r); writer.flush(); - log.log(logLevel, baos.toString()); + log.log(logLevel, "{}", baos); } writeResult = writer.finishRecordSet(); writer.flush(); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/AbstractHeartbeatMonitor.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/AbstractHeartbeatMonitor.java index 549b030804..c700453a1b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/AbstractHeartbeatMonitor.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/heartbeat/AbstractHeartbeatMonitor.java @@ -154,8 +154,7 @@ public abstract class AbstractHeartbeatMonitor implements HeartbeatMonitor { } catch (final Exception e) { clusterCoordinator.reportEvent(null, Severity.ERROR, "Received heartbeat from " + heartbeat.getNodeIdentifier() + " but failed to process heartbeat due to " + e); - logger.error("Failed to process heartbeat from {} due to {}", heartbeat.getNodeIdentifier(), e.toString()); - logger.error("", e); + logger.error("Failed to process heartbeat from {}", heartbeat.getNodeIdentifier(), e); } } @@ -193,8 +192,7 @@ public abstract class AbstractHeartbeatMonitor implements HeartbeatMonitor { try { removeHeartbeat(nodeIdentifier); } catch (final Exception e) { - logger.warn("Failed to remove heartbeat for {} due to {}", nodeIdentifier, e.toString()); - logger.warn("", e); + logger.warn("Failed to remove heartbeat for {}", nodeIdentifier, e); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/StandardAsyncClusterResponse.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/StandardAsyncClusterResponse.java index ff94eba4c5..6958552d74 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/StandardAsyncClusterResponse.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/StandardAsyncClusterResponse.java @@ -132,7 +132,7 @@ public class StandardAsyncClusterResponse implements AsyncClusterResponse { for (final Map.Entry<String, Long> entry : timingInfo.entrySet()) { sb.append(entry.getKey()).append(" took ").append(TimeUnit.NANOSECONDS.toMillis(entry.getValue())).append(" millis\n"); } - logger.debug(sb.toString()); + logger.debug("{}", sb); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java index 5c78b66dcc..ab150aa531 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/replication/ThreadPoolRequestReplicator.java @@ -802,7 +802,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator, Closeable logger.debug("For {} {} (Request ID {}), minimum response time = {}, max = {}, average = {} ms", response.getMethod(), response.getURIPath(), response.getRequestIdentifier(), stats.getMin(), stats.getMax(), stats.getAverage()); - logger.debug(sb.toString()); + logger.debug("{}", sb); } @@ -872,8 +872,7 @@ public class ThreadPoolRequestReplicator implements RequestReplicator, Closeable nodeResponse = replicateRequest(request, nodeId, uri, requestId, clusterResponse); } catch (final Throwable t) { nodeResponse = new NodeResponse(nodeId, method, uri, t); - logger.warn("Failed to replicate request {} {} to {} due to {}", method, uri.getPath(), nodeId, t.toString()); - logger.warn("", t); + logger.warn("Failed to replicate request {} {} to {}", method, uri.getPath(), nodeId, t); } if (callback != null) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java index 02fe471646..8d934b286e 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/flowanalysis/AbstractFlowAnalysisRuleNode.java @@ -287,7 +287,7 @@ public abstract class AbstractFlowAnalysisRuleNode extends AbstractComponentNode componentLog.error("Failed to invoke {} method", cause); - log.error("Failed to invoke {} method of {} due to {}", annotation.getSimpleName(), getFlowAnalysisRule(), cause.toString()); + log.error("Failed to invoke {} method of {}", annotation.getSimpleName(), getFlowAnalysisRule(), cause); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java index 7265dc1d91..4e6605c213 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProcessSession.java @@ -685,7 +685,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn timingInfo.append("; Updating Provenance Event Repository took "); formatNanos(updateProvenanceNanos, timingInfo); - LOG.debug(timingInfo.toString()); + LOG.debug("{}", timingInfo); } // Update local state @@ -2582,7 +2582,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn context.getProvenanceRepository().registerEvents(iterable); context.getFlowFileRepository().updateRepository(expiredRecords); } catch (final IOException e) { - LOG.error("Failed to update FlowFile Repository to record expired records due to {}", e.toString(), e); + LOG.error("Failed to update FlowFile Repository to record expired records", e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java index 127e14756f..068006f4a2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/logging/repository/StandardLogRepository.java @@ -58,7 +58,7 @@ public class StandardLogRepository implements LogRepository { try { observer.onLogMessage(logMessage); } catch (final Exception observerThrowable) { - logger.error("Failed to pass log message to Observer {} due to {}", observer, observerThrowable.toString()); + logger.error("Failed to pass log message to Observer {}", observer, observerThrowable); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java index 6617173e5b..f7bab5c7b3 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/remote/StandardRemoteProcessGroup.java @@ -1288,10 +1288,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { requestAccountResponse.getStatus(), requestAccountResponse.getStatusInfo().getReasonPhrase()); } } catch (final Exception re) { - logger.error("{} Failed to request account due to {}", this, re.toString()); - if (logger.isDebugEnabled()) { - logger.error("", re); - } + logger.error("{} Failed to request account", this, re); } authorizationIssue = e.getDescription(); @@ -1299,8 +1296,7 @@ public class StandardRemoteProcessGroup implements RemoteProcessGroup { authorizationIssue = e.getDescription(); } else { final String message = e.getDescription(); - logger.warn("{} When communicating with remote instance, got unexpected result. {}", - new Object[]{this, message}); + logger.warn("{} When communicating with remote instance, got unexpected result. {}", this, message); authorizationIssue = "Unable to determine Site-to-Site availability."; } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java index 1f970b330d..e2626f6eba 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java @@ -603,7 +603,7 @@ public class ExtensionBuilder { processorNode.setBulletinLevel(ds.bulletinLevel()); } } catch (final Exception ex) { - logger.error("Error while setting default settings from DefaultSettings annotation: {}", ex.toString(), ex); + logger.error("Error while setting default settings from DefaultSettings annotation", ex); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java index 41007de2c0..81858b700e 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FlowController.java @@ -3259,10 +3259,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr try { remoteGroup.refreshFlowContents(); } catch (final CommunicationsException e) { - LOG.warn("Unable to communicate with remote instance {} due to {}", remoteGroup, e.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", e); - } + LOG.warn("Unable to communicate with remote instance {}", remoteGroup, e); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java index 1fd81047f3..d88ed12bf4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/SwappablePriorityQueue.java @@ -794,8 +794,7 @@ public class SwappablePriorityQueue { droppedSize = dropAction.drop(activeQueueRecords, requestor); logger.debug("For DropFlowFileRequest {}, Dropped {} from active queue", requestIdentifier, droppedSize); } catch (final IOException ioe) { - logger.error("Failed to drop the FlowFiles from queue {} due to {}", getQueueIdentifier(), ioe.toString()); - logger.error("", ioe); + logger.error("Failed to drop the FlowFiles from queue {}", getQueueIdentifier(), ioe); dropRequest.setState(DropFlowFileState.FAILURE, "Failed to drop FlowFiles due to " + ioe.toString()); return; @@ -817,8 +816,7 @@ public class SwappablePriorityQueue { try { droppedSize = dropAction.drop(swapQueue, requestor); } catch (final IOException ioe) { - logger.error("Failed to drop the FlowFiles from queue {} due to {}", getQueueIdentifier(), ioe.toString()); - logger.error("", ioe); + logger.error("Failed to drop the FlowFiles from queue {}", getQueueIdentifier(), ioe); dropRequest.setState(DropFlowFileState.FAILURE, "Failed to drop FlowFiles due to " + ioe.toString()); return; @@ -886,8 +884,7 @@ public class SwappablePriorityQueue { dropRequest.getDroppedSize().getObjectCount(), dropRequest.getDroppedSize().getByteCount(), getQueueIdentifier(), requestor); dropRequest.setState(DropFlowFileState.COMPLETE); } catch (final Exception e) { - logger.error("Failed to drop FlowFiles from Connection with ID {} due to {}", getQueueIdentifier(), e.toString()); - logger.error("", e); + logger.error("Failed to drop FlowFiles from Connection with ID {}", getQueueIdentifier(), e); dropRequest.setState(DropFlowFileState.FAILURE, "Failed to drop FlowFiles due to " + e.toString()); } } finally { diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java index 3ff1ef0827..c62b5a5de0 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/client/async/nio/NioAsyncLoadBalanceClient.java @@ -264,7 +264,7 @@ public class NioAsyncLoadBalanceClient implements AsyncLoadBalanceClient { try { success = loadBalanceSession.communicate(); } catch (final Exception e) { - logger.error("Failed to communicate with Peer {}", nodeIdentifier.toString(), e); + logger.error("Failed to communicate with Peer {}", nodeIdentifier, e); eventReporter.reportEvent(Severity.ERROR, "Load Balanced Connection", "Failed to communicate with Peer " + nodeIdentifier + " when load balancing data for Connection with ID " + loadBalanceSession.getPartition().getConnectionId() + " due to " + e); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java index a8f4d6462e..e7077f6584 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/FileSystemRepository.java @@ -487,8 +487,7 @@ public class FileSystemRepository implements ContentRepository { } } catch (final IOException e) { final String action = archiveData ? "archive" : "remove"; - LOG.warn("Unable to {} unknown file {} from File System Repository due to {}", action, fileDescription, e.toString()); - LOG.warn("", e); + LOG.warn("Unable to {} unknown file {} from File System Repository", action, fileDescription, e); } } @@ -519,7 +518,7 @@ public class FileSystemRepository implements ContentRepository { LOG.debug("Obtaining active resource claims, will return a list of {} resource claims for container {}", activeResourceClaims.size(), containerName); if (LOG.isTraceEnabled()) { LOG.trace("Listing of resource claims:"); - activeResourceClaims.forEach(claim -> LOG.trace(claim.toString())); + activeResourceClaims.forEach(claim -> LOG.trace("{}", claim)); } return activeResourceClaims; @@ -1321,10 +1320,7 @@ public class FileSystemRepository implements ContentRepository { return; } } catch (final IOException ioe) { - LOG.warn("Failed to delete {} from archive due to {}", toDelete, ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", ioe); - } + LOG.warn("Failed to delete {} from archive", toDelete, ioe); } } @@ -1361,10 +1357,7 @@ public class FileSystemRepository implements ContentRepository { LOG.debug("Deleted archived ContentClaim with ID {} from Container {} because it was older than the configured max archival duration", file.toFile().getName(), containerName); } catch (final IOException ioe) { - LOG.warn("Failed to remove archived ContentClaim with ID {} from Container {} due to {}", file.toFile().getName(), containerName, ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", ioe); - } + LOG.warn("Failed to remove archived ContentClaim with ID {} from Container {}", file.toFile().getName(), containerName, ioe); } } else if (usableSpace < minRequiredSpace) { notYetExceedingThreshold.add(new ArchiveInfo(container, file, attrs.size(), lastModTime)); @@ -1374,10 +1367,7 @@ public class FileSystemRepository implements ContentRepository { } }); } catch (final IOException ioe) { - LOG.warn("Failed to cleanup archived files in {} due to {}", archive, ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", ioe); - } + LOG.warn("Failed to cleanup archived files in {}", archive, ioe); } } final long deleteExpiredMillis = stopWatch.getElapsed(TimeUnit.MILLISECONDS); @@ -1417,10 +1407,7 @@ public class FileSystemRepository implements ContentRepository { archiveFilesDeleted, FormatUtils.formatDataSize(archiveBytesDeleted), notYetExceedingThreshold.size()); } } catch (final IOException ioe) { - LOG.warn("Failed to delete {} from archive due to {}", archiveInfo, ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", ioe); - } + LOG.warn("Failed to delete {} from archive", archiveInfo, ioe); } } @@ -1479,10 +1466,7 @@ public class FileSystemRepository implements ContentRepository { successCount++; } } catch (final Exception e) { - LOG.warn("Failed to archive {} due to {}", claim, e.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", e); - } + LOG.warn("Failed to archive {}", claim, e); } } else if (remove(claim)) { successCount++; @@ -1505,10 +1489,7 @@ public class FileSystemRepository implements ContentRepository { } } } catch (final Throwable t) { - LOG.error("Failed to handle destructable claims due to {}", t.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", t); - } + LOG.error("Failed to handle destructable claims", t); } } } @@ -1566,15 +1547,10 @@ public class FileSystemRepository implements ContentRepository { final ContainerState containerState = containerStateMap.get(containerName); containerState.signalCreationReady(); // indicate that we've finished cleaning up the archive. } catch (final IOException ioe) { - LOG.error("Failed to cleanup archive for container {} due to {}", containerName, ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", ioe); - } - return; + LOG.error("Failed to cleanup archive for container {}", containerName, ioe); } } catch (final Throwable t) { - LOG.error("Failed to cleanup archive for container {} due to {}", containerName, t.toString()); - LOG.error("", t); + LOG.error("Failed to cleanup archive for container {}", containerName, t); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java index 2a4e601537..715c04cbdf 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/scheduling/StandardProcessScheduler.java @@ -216,8 +216,7 @@ public final class StandardProcessScheduler implements ProcessScheduler { try { schedulingAgent.shutdown(); } catch (final Throwable t) { - LOG.error("Failed to shutdown Scheduling Agent {} due to {}", schedulingAgent, t.toString()); - LOG.error("", t); + LOG.error("Failed to shutdown Scheduling Agent {}", schedulingAgent, t); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java index c780ba348b..7ff21e7fc1 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/serialization/VersionedFlowSynchronizer.java @@ -204,7 +204,7 @@ public class VersionedFlowSynchronizer implements FlowSynchronizer { logger.info("In order to inherit proposed dataflow, will stop any components that will be affected by the update"); if (logger.isDebugEnabled()) { logger.debug("Will stop the following components:"); - logger.debug(activeSet.toString()); + logger.debug("{}", activeSet); final String differencesToString = flowDifferences.stream() .map(FlowDifference::toString) .collect(Collectors.joining("\n")); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java index 5461ba4575..9958601b98 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/state/providers/local/WriteAheadLocalStateProvider.java @@ -178,8 +178,7 @@ public class WriteAheadLocalStateProvider extends AbstractStateProvider { try { writeAheadLog.shutdown(); } catch (final IOException ioe) { - logger.warn("Failed to shut down {} successfully due to {}", this, ioe.toString()); - logger.warn("", ioe); + logger.warn("Failed to shut down {} successfully", this, ioe); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java index 6d493e8cd2..bb46cb629a 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ConnectableTask.java @@ -291,7 +291,7 @@ public class ConnectableTask { try { rawSession.commitAsync(null, t -> { - procLog.error("Failed to commit session {} due to {}; rolling back", rawSession, t.toString(), t); + procLog.error("Failed to commit session {}; rolling back", rawSession, t); }); } catch (final TerminatedTaskException tte) { procLog.debug("Cannot commit Batch Process Session because the Task was forcefully terminated", tte); @@ -301,8 +301,7 @@ public class ConnectableTask { try { updateEventRepo(startNanos, startCpuTime, startGcMillis, invocationCount, measureCpuTime, performanceTracker); } catch (final IOException e) { - logger.error("Unable to update FlowFileEvent Repository for {}; statistics may be inaccurate. Reason for failure: {}", connectable.getRunnableComponent(), e.toString()); - logger.error("", e); + logger.error("Unable to update FlowFileEvent Repository for {}; statistics may be inaccurate.", connectable.getRunnableComponent(), e); } } finally { lifecycleState.decrementActiveThreadCount(); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ExpireFlowFiles.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ExpireFlowFiles.java index ee9f550efe..d1523de6f7 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ExpireFlowFiles.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/tasks/ExpireFlowFiles.java @@ -56,7 +56,7 @@ public class ExpireFlowFiles implements Runnable { try { expireFlowFiles(rootGroup); } catch (final Exception e) { - logger.error("Failed to expire FlowFiles due to {}", e.toString(), e); + logger.error("Failed to expire FlowFiles", e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnosticsFactory.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnosticsFactory.java index 566f80b970..4472cf6f1c 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnosticsFactory.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/SystemDiagnosticsFactory.java @@ -93,10 +93,7 @@ public class SystemDiagnosticsFactory { flowFileRepoStorageUsage.setFreeSpace(0L); flowFileRepoStorageUsage.setTotalSpace(-1L); - logger.warn("Unable to determine FlowFile Repository usage due to {}", ioe.toString()); - if (logger.isDebugEnabled()) { - logger.warn("", ioe); - } + logger.warn("Unable to determine FlowFile Repository usage", ioe); } systemDiagnostics.setFlowFileRepositoryStorageUsage(flowFileRepoStorageUsage); @@ -111,10 +108,7 @@ public class SystemDiagnosticsFactory { containerFree = contentRepo.getContainerUsableSpace(containerName); containerCapacity = contentRepo.getContainerCapacity(containerName); } catch (final IOException ioe) { - logger.warn("Unable to determine Content Repository usage for container {} due to {}", containerName, ioe.toString()); - if (logger.isDebugEnabled()) { - logger.warn("", ioe); - } + logger.warn("Unable to determine Content Repository usage for container {}", containerName, ioe); } final StorageUsage storageUsage = new StorageUsage(); @@ -136,10 +130,7 @@ public class SystemDiagnosticsFactory { containerFree = provenanceRepository.getContainerUsableSpace(containerName); containerCapacity = provenanceRepository.getContainerCapacity(containerName); } catch (final IOException ioe) { - logger.warn("Unable to determine Provenance Repository usage for container {} due to {}", containerName, ioe.toString()); - if (logger.isDebugEnabled()) { - logger.warn("", ioe); - } + logger.warn("Unable to determine Provenance Repository usage for container {}", containerName, ioe); } final StorageUsage storageUsage = new StorageUsage(); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java index 1e21a50cfc..b78700ec21 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/StandardExtensionDiscoveringManager.java @@ -793,7 +793,7 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering builder.append("\n\t=== End ").append(entry.getKey().getSimpleName()).append(" types ==="); } - logger.info(builder.toString()); + logger.info("{}", builder); } @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-zookeeper-leader-election/src/main/java/org/apache/nifi/framework/cluster/leader/zookeeper/CuratorLeaderElectionManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-zookeeper-leader-election/src/main/java/org/apache/nifi/framework/cluster/leader/zookeeper/CuratorLeaderElectionManager.java index 045671652f..2daa464597 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-zookeeper-leader-election/src/main/java/org/apache/nifi/framework/cluster/leader/zookeeper/CuratorLeaderElectionManager.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-zookeeper-leader-election/src/main/java/org/apache/nifi/framework/cluster/leader/zookeeper/CuratorLeaderElectionManager.java @@ -322,11 +322,7 @@ public class CuratorLeaderElectionManager extends TrackedLeaderElectionManager { // If there is no ZNode, then there is no elected leader. return Optional.empty(); } catch (final Exception e) { - logger.warn("Unable to determine the Elected Leader for role '{}' due to {}; assuming no leader has been elected", roleName, e.toString()); - if (logger.isDebugEnabled()) { - logger.warn("", e); - } - + logger.warn("Unable to determine the Elected Leader for role '{}'; assuming no leader has been elected", roleName, e); return Optional.empty(); } } finally { @@ -563,10 +559,7 @@ public class CuratorLeaderElectionManager extends TrackedLeaderElectionManager { try { listener.onStopLeading(); } catch (final Exception e) { - logger.error("This node is no longer leader for role '{}' but failed to shutdown leadership responsibilities properly due to: {}", roleName, e.toString()); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("This node is no longer leader for role '{}' but failed to shutdown leadership responsibilities properly", roleName, e); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java index d7b6968ab1..dbd330faab 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java +++ b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/NiFi.java @@ -188,7 +188,7 @@ public class NiFi implements NiFiEntryPoint { protected void setDefaultUncaughtExceptionHandler() { Thread.setDefaultUncaughtExceptionHandler((thread, exception) -> { - LOGGER.error("An Unknown Error Occurred in Thread {}: {}", thread, exception.toString(), exception); + LOGGER.error("An Unknown Error Occurred in Thread {}", thread, exception); }); } @@ -428,7 +428,7 @@ public class NiFi implements NiFiEntryPoint { passwordFile.delete(); } catch (IOException e) { - LOGGER.error("Caught IOException while retrieving the {} -passed keyfile; aborting: {}", KEY_FILE_FLAG, e.toString()); + LOGGER.error("Caught IOException while retrieving the {} -passed keyfile; aborting", KEY_FILE_FLAG, e); System.exit(1); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java index 812b147ff2..97b0f50399 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java +++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/SocketRemoteSiteListener.java @@ -130,10 +130,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } } catch (final IOException e) { - LOG.error("Unable to open server socket due to {}", e.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", e); - } + LOG.error("Unable to open server socket", e); } @@ -285,21 +282,12 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } LOG.debug("Finished communicating with {} ({})", peer, protocol); } catch (final Exception e) { - LOG.error("Unable to communicate with remote instance {} ({}) due to {}; closing connection", peer, protocol, e.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", e); - } + LOG.error("Unable to communicate with remote instance {} ({}); closing connection", peer, protocol, e); } } catch (final IOException e) { - LOG.error("Unable to communicate with remote instance {} due to {}; closing connection", peer, e.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", e); - } + LOG.error("Unable to communicate with remote instance {}; closing connection", peer, e); } catch (final Throwable t) { - LOG.error("Handshake failed when communicating with {}; closing connection. Reason for failure: {}", peerUri, t.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", t); - } + LOG.error("Handshake failed when communicating with {}; closing connection.", peerUri, t); } finally { LOG.trace("Cleaning up"); try { @@ -307,7 +295,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { protocol.shutdown(peer); } } catch (final Exception protocolException) { - LOG.warn("Failed to shutdown protocol due to {}", protocolException.toString()); + LOG.warn("Failed to shutdown protocol", protocolException); } try { @@ -315,7 +303,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { peer.close(); } } catch (final Exception peerException) { - LOG.warn("Failed to close peer due to {}; some resources may not be appropriately cleaned up", peerException.toString()); + LOG.warn("Failed to close peer; some resources may not be appropriately cleaned up", peerException); } LOG.trace("Finished cleaning up"); } @@ -399,10 +387,7 @@ public class SocketRemoteSiteListener implements RemoteSiteListener { } } } catch (final IOException e) { - LOG.error("RemoteSiteListener Unable to accept connection due to {}", e.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", e); - } + LOG.error("RemoteSiteListener Unable to accept connection", e); return acceptedSocket; } LOG.trace("Got connection"); diff --git a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java index 3439d22829..0f37df96e2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java +++ b/nifi-framework-bundle/nifi-framework/nifi-site-to-site/src/main/java/org/apache/nifi/remote/StandardRemoteGroupPort.java @@ -280,10 +280,7 @@ public class StandardRemoteGroupPort extends RemoteGroupPort { if (t instanceof TransmissionDisabledException) { logger.debug(message, t); } else { - logger.error("{} failed to communicate with remote NiFi instance due to {}", this, t.toString()); - if (logger.isDebugEnabled()) { - logger.error("", t); - } + logger.error("{} failed to communicate with remote NiFi instance", this, t); remoteGroup.getEventReporter().reportEvent(Severity.ERROR, CATEGORY, message); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/dto/DtoFactoryTest.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/dto/DtoFactoryTest.java index 358d9d2ff9..bfbaaf48b4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/dto/DtoFactoryTest.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/test/java/org/apache/nifi/web/api/dto/DtoFactoryTest.java @@ -83,7 +83,7 @@ public class DtoFactoryTest { final List<AllowableValueEntity> allowableValues = dto.getAllowableValues(); final List<String> namesActual = allowableValues.stream() .map(v -> v.getAllowableValue().getDisplayName()).collect(Collectors.toList()); - logger.trace(namesActual.toString()); + logger.trace("{}", namesActual); assertEquals(Arrays.asList("ReaderX", "ReaderY", "ReaderZ"), namesActual); } @@ -106,7 +106,7 @@ public class DtoFactoryTest { final List<AllowableValueEntity> allowableValues = dto.getAllowableValues(); final List<String> namesActual = allowableValues.stream() .map(v -> v.getAllowableValue().getDisplayName()).collect(Collectors.toList()); - logger.trace(namesActual.toString()); + logger.trace("{}", namesActual); assertEquals(Arrays.asList("Default Signature", "Signature v4", "Signature v2"), namesActual); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509AuthenticationProvider.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509AuthenticationProvider.java index adf0a16ec2..e3495ef83e 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509AuthenticationProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/X509AuthenticationProvider.java @@ -157,7 +157,7 @@ public class X509AuthenticationProvider extends NiFiAuthenticationProvider { user = user.getChain(); } builder.append("\n============"); - LOGGER.trace(builder.toString()); + LOGGER.trace("{}", builder); } /** diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java index 8b90263e45..1e3b86902b 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java @@ -140,7 +140,7 @@ class GitFlowMetaData { } private static boolean hasAtLeastOneReference(Repository repo) throws IOException { - logger.info("Checking references for repository {}", repo.toString()); + logger.info("Checking references for repository {}", repo); for (Ref ref : repo.getRefDatabase().getRefs()) { if (ref.getObjectId() == null) { continue; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/LoggingEventHookProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/LoggingEventHookProvider.java index 9ceb59f6a4..55d98faae1 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/LoggingEventHookProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/LoggingEventHookProvider.java @@ -53,7 +53,7 @@ public class LoggingEventHookProvider builder.append("] "); - LOGGER.info(builder.toString()); + LOGGER.info("{}", builder); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistrySecurityConfig.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistrySecurityConfig.java index 0c60fd7ba9..476c08b30c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistrySecurityConfig.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistrySecurityConfig.java @@ -167,7 +167,7 @@ public class NiFiRegistrySecurityConfig { // return a 401 response final int status = HttpServletResponse.SC_UNAUTHORIZED; logger.info("Client could not be authenticated due to: {} Returning 401 response.", authenticationException.toString()); - logger.debug("", authenticationException); + logger.debug("HTTP 401 Unauthorized", authenticationException); if (!response.isCommitted()) { response.setStatus(status); diff --git a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/RunStatelessFlow.java b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/RunStatelessFlow.java index 3a9c1819b9..43187b629f 100644 --- a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/RunStatelessFlow.java +++ b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/RunStatelessFlow.java @@ -96,7 +96,7 @@ public class RunStatelessFlow { final StatelessDataflowValidation validation = dataflow.performValidation(); if (!validation.isValid()) { - logger.error(validation.toString()); + logger.error("{}", validation); throw new IllegalStateException("Dataflow is not valid"); } diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/reporting/LogComponentStatuses.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/reporting/LogComponentStatuses.java index 220bbc531f..40a6e51c27 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/reporting/LogComponentStatuses.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/controller/reporting/LogComponentStatuses.java @@ -121,7 +121,7 @@ public class LogComponentStatuses implements Runnable { } builder.append(processorBorderLine); - logger.info(builder.toString()); + logger.info("{}", builder); } private void addStatus(final ProcessorAndEvent processorAndEvent, final StringBuilder builder, final int secondsInEvent, final long totalNanos) { @@ -182,7 +182,7 @@ public class LogComponentStatuses implements Runnable { } builder.append(counterBorderLine); - logger.info(builder.toString()); + logger.info("{}", builder); } private static class ProcessorAndEvent { diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/session/StatelessProcessSession.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/session/StatelessProcessSession.java index 82f32d51b8..0e7876c958 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/session/StatelessProcessSession.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/session/StatelessProcessSession.java @@ -341,7 +341,7 @@ public class StatelessProcessSession extends StandardProcessSession { procEvent.setInvocations(1); getRepositoryContext().getFlowFileEventRepository().updateRepository(procEvent, connectable.getIdentifier()); } catch (final IOException e) { - logger.error("Unable to update FlowFileEvent Repository for {}; statistics may be inaccurate. Reason for failure: {}", connectable.getRunnableComponent(), e.toString(), e); + logger.error("Unable to update FlowFileEvent Repository for {}; statistics may be inaccurate.", connectable.getRunnableComponent(), e); } }