From 7deac6afac19c95f16bd8a5af76ff2aa52ba49d2 Mon Sep 17 00:00:00 2001 From: dan-s1 Date: Tue, 11 Jun 2024 23:26:58 -0400 Subject: [PATCH] NIFI-13266 Removed String concatenation in logging messages (#8940) Signed-off-by: David Handermann --- .../http/url/ProxyAwareC2UrlProvider.java | 2 +- .../TransferDebugOperationHandler.java | 4 +- .../minifi/bootstrap/command/StopRunner.java | 2 +- .../ingestors/RestChangeIngestor.java | 8 +-- .../PeriodicStatusReporterManager.java | 2 +- .../bootstrap/util/UnixProcessUtils.java | 4 +- .../nifi/minifi/integration/util/LogUtil.java | 4 +- .../UpdatePropertiesPropertyProvider.java | 4 +- .../minifi/status/StatusConfigReporter.java | 8 +-- .../java/org/apache/nifi/minifi/MiNiFi.java | 2 +- .../minifi/bootstrap/BootstrapListener.java | 4 +- .../org/apache/nifi/bootstrap/RunNiFi.java | 4 +- .../functions/JsonPathEvaluator.java | 4 +- .../functions/JsonPathPutEvaluator.java | 2 +- .../functions/JsonPathUpdateEvaluator.java | 2 +- .../record/util/DataTypeUtils.java | 2 +- .../security/krb/AbstractKerberosUser.java | 2 +- .../client/socket/EndpointConnectionPool.java | 4 +- .../remote/util/SiteToSiteRestApiClient.java | 2 +- .../nifi/io/nio/AbstractChannelReader.java | 4 +- .../apache/nifi/io/nio/ChannelDispatcher.java | 4 +- .../apache/nifi/io/nio/ChannelListener.java | 22 +++--- .../apache/nifi/io/socket/SocketListener.java | 10 +-- .../org/apache/nifi/util/file/FileUtils.java | 10 +-- .../file/classloader/ClassLoaderUtils.java | 4 +- .../org/apache/nifi/web/util/WebUtils.java | 2 +- .../org/apache/nifi/wali/HashMapSnapshot.java | 11 ++- .../nifi/wali/LengthDelimitedJournal.java | 11 ++- .../nifi/amqp/processors/AMQPConsumer.java | 2 +- .../nifi/amqp/processors/AMQPPublisher.java | 5 +- .../nifi/amqp/processors/AMQPWorker.java | 4 +- .../nifi/amqp/processors/PublishAMQP.java | 2 +- .../org/apache/nifi/jasn1/JASN1Reader.java | 2 +- .../dynamodb/AbstractDynamoDBProcessor.java | 6 +- ...SCredentialsProviderControllerService.java | 2 +- .../aws/dynamodb/DeleteDynamoDB.java | 8 +-- .../processors/aws/dynamodb/GetDynamoDB.java | 6 +- .../processors/aws/dynamodb/PutDynamoDB.java | 8 +-- .../aws/dynamodb/PutDynamoDBRecord.java | 11 ++- .../AbstractKinesisRecordProcessor.java | 2 +- .../nifi/processors/aws/s3/PutS3Object.java | 14 ++-- ...AzureKeyVaultSecretsParameterProvider.java | 3 +- .../azure/eventhub/ConsumeAzureEventHub.java | 3 +- .../ComponentStateCheckpointStore.java | 2 +- .../utils/AbstractStorageClientFactory.java | 2 +- .../document/AzureCosmosDBClientService.java | 2 +- ...reLogAnalyticsProvenanceReportingTask.java | 2 +- .../mysql/processors/CaptureChangeMySQL.java | 4 +- .../client/RestSchemaRegistryClient.java | 6 +- .../processors/evtx/parser/ChunkHeader.java | 4 +- .../apache/nifi/processor/util/bin/Bin.java | 2 +- .../dispatcher/DatagramChannelDispatcher.java | 5 +- .../util/file/transfer/PutFileTransfer.java | 2 +- .../hadoop/AbstractHadoopProcessor.java | 2 +- .../processors/hadoop/HDFSResourceHelper.java | 6 +- .../util/list/AbstractListProcessor.java | 11 ++- .../org/apache/nifi/avro/AvroTypeUtil.java | 2 +- .../SocketChannelRecordReaderDispatcher.java | 2 +- .../provenance/ProvenanceEventConsumer.java | 6 +- .../processors/geohash/GeohashRecord.java | 2 +- .../graph/ExecuteGraphQueryRecord.java | 2 +- .../nifi/graph/Neo4JCypherClientService.java | 2 +- .../groovyx/ExecuteGroovyScript.java | 8 +-- .../hadoop/HDFSExternalResourceProvider.java | 2 +- .../nifi/processors/hadoop/GetHDFS.java | 2 +- .../hadoop/GetHDFSSequenceFile.java | 2 +- .../nifi/processors/hadoop/MoveHDFS.java | 2 +- .../cacheclient/HazelcastMapCacheClient.java | 11 +-- .../IMapBasedHazelcastCacheManager.java | 2 +- .../org/apache/nifi/hbase/PutHBaseCell.java | 2 +- .../org/apache/nifi/hbase/PutHBaseJSON.java | 2 +- .../org/apache/nifi/hbase/PutHBaseRecord.java | 2 +- .../iceberg/AbstractIcebergProcessor.java | 2 +- .../converter/IcebergRecordConverter.java | 2 +- .../jms/cf/JMSConnectionFactoryHandler.java | 8 +-- .../jms/processors/AbstractJMSProcessor.java | 2 +- .../nifi/jms/processors/JMSConsumer.java | 2 +- .../nifi/jms/processors/JMSPublisher.java | 3 +- .../nifi/jms/processors/PublishJMS.java | 2 +- .../processors/kafka/pubsub/ConsumerPool.java | 4 +- .../nifi/kerberos/KerberosProvider.java | 4 +- .../controller/kudu/KuduLookupService.java | 2 +- .../ldap/tenants/LdapUserGroupProvider.java | 4 +- .../provenance/RepositoryConfiguration.java | 2 +- .../index/lucene/IndexDirectoryManager.java | 4 +- .../index/lucene/LuceneCacheWarmer.java | 6 +- .../index/lucene/LuceneEventIndex.java | 6 +- .../provenance/index/lucene/QueryTask.java | 6 +- .../nifi/provenance/lucene/DocsReader.java | 2 +- .../CompressableRecordReader.java | 2 +- .../store/PartitionedEventStore.java | 4 +- .../provenance/store/RecordWriterLease.java | 4 +- .../store/WriteAheadStorePartition.java | 2 +- ...RedisDistributedMapCacheClientService.java | 2 +- .../nifi/redis/state/RedisStateProvider.java | 2 +- .../apache/nifi/redis/util/RedisUtils.java | 8 +-- .../script/BaseScriptedLookupService.java | 2 +- .../script/InvokeScriptedProcessor.java | 6 +- .../script/ScriptedPartitionRecord.java | 2 +- .../script/ScriptedRouterProcessor.java | 2 +- .../SiteToSiteProvenanceReportingTask.java | 4 +- .../processors/AbstractSNMPProcessor.java | 2 +- .../snowflake/GetSnowflakeIngestStatus.java | 7 +- .../snowflake/PutSnowflakeInternalStage.java | 2 +- .../snowflake/StartSnowflakeIngest.java | 4 +- .../nifi/processors/splunk/GetSplunk.java | 2 +- .../parameter/DatabaseParameterProvider.java | 2 +- .../nifi/processors/standard/CountText.java | 6 +- .../standard/DeduplicateRecord.java | 2 +- .../processors/standard/EnforceOrder.java | 2 +- .../standard/ExecuteStreamCommand.java | 4 +- .../nifi/processors/standard/ForkRecord.java | 4 +- .../standard/HandleHttpResponse.java | 3 +- .../nifi/processors/standard/ListenHTTP.java | 2 +- .../processors/standard/ListenTCPRecord.java | 4 +- .../processors/standard/ListenUDPRecord.java | 4 +- .../processors/standard/MonitorActivity.java | 7 +- .../standard/PutDatabaseRecord.java | 20 +++--- .../nifi/processors/standard/SplitText.java | 8 +-- .../nifi/processors/standard/TailFile.java | 2 +- .../standard/UpdateDatabaseTable.java | 8 +-- .../processors/standard/merge/RecordBin.java | 6 +- .../standard/merge/RecordBinManager.java | 2 +- .../ContentAcknowledgmentServlet.java | 4 +- .../standard/servlets/ListenHTTPServlet.java | 4 +- .../processors/standard/util/FTPTransfer.java | 6 +- .../standard/util/SFTPTransfer.java | 6 +- .../processors/standard/TestExecuteSQL.java | 2 +- .../processors/standard/TestTailFile.java | 2 +- .../nifi/lookup/CSVRecordLookupService.java | 4 +- .../DistributedMapCacheLookupService.java | 2 +- .../lookup/SimpleCsvFileLookupService.java | 4 +- .../CommonsConfigurationLookupService.java | 2 +- .../nifi/lookup/maxmind/IPLookupService.java | 4 +- .../attributes/UpdateAttribute.java | 5 +- .../AbstractWebSocketGatewayProcessor.java | 2 +- .../processors/websocket/PutWebSocket.java | 2 +- .../EventSubscribeXmlRenderingCallback.java | 11 ++- ...ventSubscribeXmlRenderingCallbackTest.java | 4 +- .../FileAccessPolicyProvider.java | 2 +- .../CompositeUserGroupProvider.java | 2 +- .../protocol/impl/SocketProtocolListener.java | 4 +- .../zookeeper/ZooKeeperClientConfig.java | 2 +- .../http/StandardHttpResponseMapper.java | 2 +- .../node/NodeClusterCoordinator.java | 4 +- .../validation/StandardValidationTrigger.java | 2 +- .../controller/StandardProcessorNode.java | 4 +- .../repository/StandardProcessSession.java | 30 +++----- .../StandardProvenanceReporter.java | 70 ++++--------------- .../StandardControllerServiceProvider.java | 4 +- .../nifi/groups/StandardProcessGroup.java | 4 +- .../org/apache/nifi/util/ReflectionUtils.java | 2 +- .../controller/AbstractComponentNode.java | 10 +-- .../apache/nifi/controller/ComponentNode.java | 2 +- .../nifi/controller/ExtensionBuilder.java | 8 +-- .../controller/FileSystemSwapManager.java | 2 +- .../nifi/controller/FlowController.java | 33 ++++----- .../nifi/controller/StandardFlowService.java | 41 +++++------ .../queue/SwappablePriorityQueue.java | 2 +- .../server/StandardLoadBalanceProtocol.java | 4 +- .../repository/FileSystemRepository.java | 2 +- .../WriteAheadFlowFileRepository.java | 4 +- .../crypto/EncryptedFileSystemRepository.java | 2 +- .../scheduling/StandardProcessScheduler.java | 2 +- .../BootstrapDiagnosticsFactory.java | 2 +- .../StandardFlowConfigurationDAO.java | 5 +- .../apache/nifi/nar/NarAutoLoaderTask.java | 2 +- .../apache/nifi/nar/StandardNarLoader.java | 2 +- .../apache/nifi/nar/InstanceClassLoader.java | 4 +- .../org/apache/nifi/nar/NarCloseable.java | 2 +- .../StandardExtensionDiscoveringManager.java | 2 +- .../AbstractNativeLibHandlingClassLoader.java | 2 +- .../org/apache/nifi/nar/NarClassLoader.java | 4 +- .../org/apache/nifi/nar/NarClassLoaders.java | 5 +- .../java/org/apache/nifi/util/FileUtils.java | 4 +- .../org/apache/nifi/BootstrapListener.java | 10 +-- .../authorization/ShellUserGroupProvider.java | 42 +++++------ .../nifi/authorization/util/ShellRunner.java | 4 +- .../nifi/web/server/HostHeaderHandler.java | 4 +- .../apache/nifi/web/server/JettyServer.java | 6 +- .../StandardNiFiWebConfigurationContext.java | 5 +- .../apache/nifi/web/api/VersionsResource.java | 4 +- .../web/security/ProxiedEntitiesUtils.java | 8 +-- .../requests/ContentLengthFilter.java | 4 +- .../x509/ocsp/OcspCertificateValidator.java | 2 +- .../nifi/util/MockProvenanceReporter.java | 65 ++++------------- .../registry/bootstrap/RunNiFiRegistry.java | 4 +- .../nifi/registry/db/DatabaseKeyService.java | 6 +- .../nifi/registry/event/EventService.java | 2 +- .../registry/extension/ExtensionManager.java | 6 +- .../FileSystemBundlePersistenceProvider.java | 8 +-- .../FileSystemFlowPersistenceProvider.java | 2 +- .../provider/flow/git/GitFlowMetaData.java | 2 +- .../hook/ScriptEventHookProvider.java | 2 +- ...tractConfigurableAccessPolicyProvider.java | 8 +-- .../DatabaseAccessPolicyProvider.java | 4 +- .../file/FileAccessPolicyProvider.java | 2 +- .../authorization/shell/ShellRunner.java | 4 +- .../shell/ShellUserGroupProvider.java | 40 +++++------ .../ldap/tenants/LdapUserGroupProvider.java | 4 +- .../security/util/ClassLoaderUtils.java | 2 +- .../registry/service/RegistryService.java | 2 +- .../NiFiRegistryPropertiesLoader.java | 2 +- .../nifi/registry/BootstrapListener.java | 8 +-- .../apache/nifi/registry/NiFiRegistry.java | 4 +- .../security/util/ProxiedEntitiesUtils.java | 8 +-- .../apache/nifi/registry/util/FileUtils.java | 6 +- .../nifi/registry/web/api/AccessResource.java | 13 ++-- .../registry/web/api/ApplicationResource.java | 2 +- .../NiFiRegistryMasterKeyProviderFactory.java | 15 ++-- .../authentication/jwt/JwtService.java | 5 +- .../kerberos/KerberosIdentityProvider.java | 11 ++- .../oidc/StandardOidcIdentityProvider.java | 3 +- .../registry/web/api/DBFlowStorageIT.java | 2 +- .../web/api/SecureNiFiRegistryClientIT.java | 2 +- .../nifi/registry/web/api/SecureProxyIT.java | 2 +- .../api/UnsecuredNiFiRegistryClientIT.java | 4 +- .../aws/S3BundlePersistenceProvider.java | 5 +- .../bootstrap/StatelessBootstrap.java | 2 +- .../PropertiesFileFlowDefinitionParser.java | 10 +-- .../engine/StandardStatelessEngine.java | 4 +- .../flow/StandardStatelessFlowCurrent.java | 8 +-- .../StatelessFileSystemContentRepository.java | 2 +- 223 files changed, 547 insertions(+), 692 deletions(-) diff --git a/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/ProxyAwareC2UrlProvider.java b/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/ProxyAwareC2UrlProvider.java index c5fb9059fa..aeb8708101 100644 --- a/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/ProxyAwareC2UrlProvider.java +++ b/c2/c2-client-bundle/c2-client-http/src/main/java/org/apache/nifi/c2/client/http/url/ProxyAwareC2UrlProvider.java @@ -74,7 +74,7 @@ public class ProxyAwareC2UrlProvider implements C2UrlProvider { try { return Optional.of(c2RestPathBase.resolve(stripStart(path, SLASH)).toString()); // leading slash needs to be removed for proper URL creation } catch (Exception e) { - LOG.error("Unable to convert restBase=" + c2RestPathBase + " and restPath=" + path + " to absolute url", e); + LOG.error("Unable to convert restBase={} and restPath={} to absolute url", c2RestPathBase, path, e); return Optional.empty(); } } diff --git a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/TransferDebugOperationHandler.java b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/TransferDebugOperationHandler.java index 4544b07dd8..e2b045bfc9 100644 --- a/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/TransferDebugOperationHandler.java +++ b/c2/c2-client-bundle/c2-client-service/src/main/java/org/apache/nifi/c2/client/service/operation/TransferDebugOperationHandler.java @@ -182,7 +182,7 @@ public class TransferDebugOperationHandler implements C2OperationHandler { gzipInputStream.transferTo(fileOutputStream); return targetFile; } catch (IOException e) { - LOG.error("Error during filtering gzip file content: " + sourceFile.toAbsolutePath(), e); + LOG.error("Error during filtering gzip file content: {}", sourceFile.toAbsolutePath(), e); throw e; } } @@ -192,7 +192,7 @@ public class TransferDebugOperationHandler implements C2OperationHandler { Files.write(targetFile, (Iterable) fileStream.filter(contentFilter)::iterator); return targetFile; } catch (IOException e) { - LOG.error("Error during filtering uncompressed file content: " + sourceFile.toAbsolutePath(), e); + LOG.error("Error during filtering uncompressed file content: {}", sourceFile.toAbsolutePath(), e); throw e; } } diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java index a5f3413e94..75d9e8bf29 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/command/StopRunner.java @@ -95,7 +95,7 @@ public class StopRunner implements CommandRunner { status = ERROR.getStatusCode(); } } catch (IOException e) { - CMD_LOGGER.warn("An error has occurred while stopping MiNiFi. Force killing process with pid=" + minifiPid, e); + CMD_LOGGER.warn("An error has occurred while stopping MiNiFi. Force killing process with pid={}", minifiPid, e); killProcessTree(minifiPid); } finally { if (lockFile.exists() && !lockFile.delete()) { diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/configuration/ingestors/RestChangeIngestor.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/configuration/ingestors/RestChangeIngestor.java index d8c35984cf..555f66daf9 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/configuration/ingestors/RestChangeIngestor.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/configuration/ingestors/RestChangeIngestor.java @@ -302,10 +302,10 @@ public class RestChangeIngestor implements ChangeIngestor { private void logRequest(Request request) { logger.info(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"); - logger.info("request method = " + request.getMethod()); - logger.info("request url = " + request.getHttpURI()); - logger.info("context path = " + request.getContext().getContextPath()); - logger.info("request content type = " + request.getHeaders().get(HttpHeader.CONTENT_TYPE)); + logger.info("request method = {}", request.getMethod()); + logger.info("request url = {}", request.getHttpURI()); + logger.info("context path = {}", request.getContext().getContextPath()); + logger.info("request content type = {}", request.getHeaders().get(HttpHeader.CONTENT_TYPE)); logger.info("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"); } } diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/PeriodicStatusReporterManager.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/PeriodicStatusReporterManager.java index 1db737e76b..5bf34ac87d 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/PeriodicStatusReporterManager.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/service/PeriodicStatusReporterManager.java @@ -68,7 +68,7 @@ public class PeriodicStatusReporterManager implements QueryableStatusAggregator try { periodicStatusReporter.stop(); } catch (Exception exception) { - LOGGER.error("Could not successfully stop periodic status reporter " + periodicStatusReporter.getClass() + " due to ", exception); + LOGGER.error("Could not successfully stop periodic status reporter {}", periodicStatusReporter.getClass(), exception); } } } diff --git a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/UnixProcessUtils.java b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/UnixProcessUtils.java index 8a1a8ee65c..bb350bca6f 100644 --- a/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/UnixProcessUtils.java +++ b/minifi/minifi-bootstrap/src/main/java/org/apache/nifi/minifi/bootstrap/util/UnixProcessUtils.java @@ -126,12 +126,12 @@ public class UnixProcessUtils implements ProcessUtils { if (retries == 0) { throw new IOException("Failed to stop process. Process is still running after killing attempt with pid=" + pid); } - LOGGER.warn("Process is still running after killing attempt with pid=" + pid); + LOGGER.warn("Process is still running after killing attempt with pid={}", pid); retries--; try { Thread.sleep(1000); } catch (InterruptedException e) { - DEFAULT_LOGGER.warn("Thread interrupted while waiting for killing process with pid=" + pid); + DEFAULT_LOGGER.warn("Thread interrupted while waiting for killing process with pid={}", pid); } } } diff --git a/minifi/minifi-integration-tests/src/test/java/org/apache/nifi/minifi/integration/util/LogUtil.java b/minifi/minifi-integration-tests/src/test/java/org/apache/nifi/minifi/integration/util/LogUtil.java index a2249bb530..2808eb5a17 100644 --- a/minifi/minifi-integration-tests/src/test/java/org/apache/nifi/minifi/integration/util/LogUtil.java +++ b/minifi/minifi-integration-tests/src/test/java/org/apache/nifi/minifi/integration/util/LogUtil.java @@ -61,9 +61,9 @@ public class LogUtil { int occurrences = 0; while ((line = bufferedReader.readLine()) != null) { if (expectedLogEntry.pattern.matcher(line).find()) { - logger.info("Found expected: " + line); + logger.info("Found expected: {}", line); if (++occurrences >= expectedLogEntry.numOccurrences) { - logger.info("Found target " + occurrences + " times"); + logger.info("Found target {} times", occurrences); satisfied = true; break; } diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/UpdatePropertiesPropertyProvider.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/UpdatePropertiesPropertyProvider.java index 50fab4fddd..d618d8f9c4 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/UpdatePropertiesPropertyProvider.java +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/c2/command/UpdatePropertiesPropertyProvider.java @@ -65,9 +65,9 @@ public class UpdatePropertiesPropertyProvider implements OperandPropertiesProvid try (FileInputStream fis = new FileInputStream(bootstrapFile)) { props.load(fis); } catch (FileNotFoundException e) { - LOGGER.error("The bootstrap configuration file " + bootstrapConfigFileLocation + " doesn't exists", e); + LOGGER.error("The bootstrap configuration file {} doesn't exist", bootstrapConfigFileLocation, e); } catch (IOException e) { - LOGGER.error("Failed to load properties from " + bootstrapConfigFileLocation, e); + LOGGER.error("Failed to load properties from {}", bootstrapConfigFileLocation, e); } return props.entrySet().stream() .collect(Collectors.toMap(entry -> (String) entry.getKey(), entry -> (String) entry.getValue())); diff --git a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/status/StatusConfigReporter.java b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/status/StatusConfigReporter.java index c9e9fc7d63..06b7d5ad6f 100644 --- a/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/status/StatusConfigReporter.java +++ b/minifi/minifi-nar-bundles/minifi-framework-bundle/minifi-framework/minifi-framework-core/src/main/java/org/apache/nifi/minifi/status/StatusConfigReporter.java @@ -128,7 +128,7 @@ public final class StatusConfigReporter { break; } } catch (Exception e) { - logger.error("Hit exception while requesting status for item '" + item + "'", e); + logger.error("Hit exception while requesting status for item '{}'", item, e); errorsGeneratingReport.add("Unable to get status for request '" + item + "' due to:" + e); } } @@ -167,7 +167,7 @@ public final class StatusConfigReporter { Collection validationResults = flowController.getFlowManager().getGroup(rootGroupId).getProcessor(processorStatus.getId()).getValidationErrors(); processorStatusBeanList.add(parseProcessorStatusRequest(processorStatus, requestItem.options, flowController, validationResults)); } else { - logger.warn("Status for processor with key " + requestItem.identifier + " was requested but one does not exist"); + logger.warn("Status for processor with key {} was requested but one does not exist", requestItem.identifier); throw new StatusRequestException("No processor with key " + requestItem.identifier + " to report status on"); } } @@ -189,7 +189,7 @@ public final class StatusConfigReporter { if (connectionStatusMap.containsKey(requestItem.identifier)) { connectionStatusList.add(parseConnectionStatusRequest(connectionStatusMap.get(requestItem.identifier), requestItem.options, logger)); } else { - logger.warn("Status for connection with key " + requestItem.identifier + " was requested but one does not exist"); + logger.warn("Status for connection with key {} was requested but one does not exist", requestItem.identifier); throw new StatusRequestException("No connection with key " + requestItem.identifier + " to report status on"); } } @@ -215,7 +215,7 @@ public final class StatusConfigReporter { RemoteProcessGroupStatus remoteProcessGroupStatus = remoteProcessGroupStatusMap.get(requestItem.identifier); remoteProcessGroupStatusList.add(parseRemoteProcessGroupStatusRequest(remoteProcessGroupStatus, requestItem.options, flowController)); } else { - logger.warn("Status for Remote Process Group with key " + requestItem.identifier + " was requested but one does not exist"); + logger.warn("Status for Remote Process Group with key {} was requested but one does not exist", requestItem.identifier); throw new StatusRequestException("No Remote Process Group with key " + requestItem.identifier + " to report status on"); } } 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 567381ddda..8c0821348b 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 @@ -227,7 +227,7 @@ public class MiNiFi { NiFiProperties properties = getValidatedMiNifiProperties(); new MiNiFi(properties); } catch (final Throwable t) { - logger.error("Failure to launch MiNiFi due to " + t, t); + logger.error("Failure to launch MiNiFi", t); } } 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 fa6b5db211..afdc9b7d01 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 @@ -234,7 +234,7 @@ public class BootstrapListener implements BootstrapCommunicator { executor.submit(() -> handleBootstrapRequest(socket)); } catch (Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t, t); + logger.error("Failed to process request from Bootstrap", t); } } } @@ -252,7 +252,7 @@ public class BootstrapListener implements BootstrapCommunicator { } } catch (Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t, t); + logger.error("Failed to process request from Bootstrap", t); } finally { try { socket.close(); diff --git a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java index 5f86a73125..50b4f6b2fe 100644 --- a/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java +++ b/nifi-bootstrap/src/main/java/org/apache/nifi/bootstrap/RunNiFi.java @@ -652,7 +652,7 @@ public class RunNiFi { final Properties sysProps = (Properties) getSystemPropertiesMethod.invoke(virtualMachine); for (Entry syspropEntry : sysProps.entrySet()) { - logger.info(syspropEntry.getKey().toString() + " = " + syspropEntry.getValue().toString()); + logger.info("{} = {}", syspropEntry.getKey(), syspropEntry.getValue()); } } catch (Throwable t) { throw new RuntimeException(t); @@ -1020,7 +1020,7 @@ public class RunNiFi { public void start(final boolean monitor) throws IOException { final Integer port = getCurrentPort(cmdLogger); if (port != null) { - cmdLogger.info("Apache NiFi is already running, listening to Bootstrap on port " + port); + cmdLogger.info("Apache NiFi is already running, listening to Bootstrap on port {}", port); return; } diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathEvaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathEvaluator.java index 31958ff7b8..1f3e9caed0 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathEvaluator.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathEvaluator.java @@ -51,13 +51,13 @@ public class JsonPathEvaluator extends JsonPathBaseEvaluator { // it is valid for a path not to be found, keys may not be there // do not spam the error log for this, instead we can log debug if enabled if (LOGGER.isDebugEnabled()) { - LOGGER.debug("PathNotFoundException for JsonPath " + compiledJsonPath.getPath(), pnf); + LOGGER.debug("PathNotFoundException for JsonPath {}", compiledJsonPath.getPath(), pnf); } return EMPTY_RESULT; } catch (Exception e) { // a failure for something *other* than path not found however, should at least be // logged. - LOGGER.error("Exception while reading JsonPath " + compiledJsonPath.getPath(), e); + LOGGER.error("Exception while reading JsonPath {}", compiledJsonPath.getPath(), e); return EMPTY_RESULT; } diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathPutEvaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathPutEvaluator.java index 8f3ea4b601..440cdbe2f1 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathPutEvaluator.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathPutEvaluator.java @@ -51,7 +51,7 @@ public class JsonPathPutEvaluator extends JsonPathUpdateEvaluator { try { result = documentContext.put(compiledJsonPath, key, value).jsonString(); } catch (Exception e) { - LOGGER.error("Failed to put value " + value + " at key " + key + " at path " + compiledJsonPath + " with error " + e.getLocalizedMessage(), e); + LOGGER.error("Failed to put value {} at key {} at path {}", value, key, compiledJsonPath, e); // assume the path did not match anything in the document return EMPTY_RESULT; } diff --git a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathUpdateEvaluator.java b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathUpdateEvaluator.java index 6ea8d7d79a..78b50fa962 100644 --- a/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathUpdateEvaluator.java +++ b/nifi-commons/nifi-expression-language/src/main/java/org/apache/nifi/attribute/expression/language/evaluation/functions/JsonPathUpdateEvaluator.java @@ -60,7 +60,7 @@ public abstract class JsonPathUpdateEvaluator extends JsonPathBaseEvaluator { LOGGER.debug("JSON Path not found: {}", compiledJsonPath.getPath(), pnf); result = documentContext.jsonString(); } catch (Exception e) { - LOGGER.error("Failed to update attribute " + e.getLocalizedMessage(), e); + LOGGER.error("Failed to update attribute", e); // assume the path did not match anything in the document return EMPTY_RESULT; } diff --git a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java index 8a213ea66f..90c6a53c0b 100644 --- a/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java +++ b/nifi-commons/nifi-record/src/main/java/org/apache/nifi/serialization/record/util/DataTypeUtils.java @@ -411,7 +411,7 @@ public class DataTypeUtils { return Optional.of(type); } } catch (Exception e) { - logger.error("Exception thrown while checking if '" + valueAsString + "' is compatible with '" + type + "'", e); + logger.error("Exception thrown while checking if '{}' is compatible with '{}'", valueAsString, type, e); } } diff --git a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java index a6c7230d62..2fede6aeed 100644 --- a/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java +++ b/nifi-commons/nifi-security-kerberos/src/main/java/org/apache/nifi/security/krb/AbstractKerberosUser.java @@ -256,7 +256,7 @@ public abstract class AbstractKerberosUser implements KerberosUser { if (principal.getName().equals("krbtgt/" + principal.getRealm() + "@" + principal.getRealm())) { if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Found TGS principal: " + principal.getName()); + LOGGER.trace("Found TGS principal: {}", principal.getName()); } return true; } diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java index 878d16b1e3..0ddd429c06 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/client/socket/EndpointConnectionPool.java @@ -341,7 +341,7 @@ public class EndpointConnectionPool implements PeerStatusProvider { protocol.shutdown(peer); } catch (final TransmissionDisabledException e) { // User disabled transmission.... do nothing. - logger.debug(this + " Transmission Disabled by User"); + logger.debug("{} Transmission Disabled by User", this); } catch (IOException e1) { } } @@ -351,7 +351,7 @@ public class EndpointConnectionPool implements PeerStatusProvider { peer.close(); } catch (final TransmissionDisabledException e) { // User disabled transmission.... do nothing. - logger.debug(this + " Transmission Disabled by User"); + logger.debug("{} Transmission Disabled by User", this); } catch (IOException e1) { } } diff --git a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java index fedd1b037e..63b697b41f 100644 --- a/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java +++ b/nifi-commons/nifi-site-to-site-client/src/main/java/org/apache/nifi/remote/util/SiteToSiteRestApiClient.java @@ -357,7 +357,7 @@ public class SiteToSiteRestApiClient implements Closeable { return getController(); } catch (IOException e) { lastException = e; - logger.warn("Failed to get controller from " + clusterUrl + " due to " + e); + logger.warn("Failed to get controller from {}", clusterUrl, e); if (logger.isDebugEnabled()) { logger.debug("", e); } diff --git a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/AbstractChannelReader.java b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/AbstractChannelReader.java index 6f147cad27..d3cb9efa86 100644 --- a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/AbstractChannelReader.java +++ b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/AbstractChannelReader.java @@ -77,7 +77,7 @@ public abstract class AbstractChannelReader implements Runnable { key.cancel(); key.channel().close(); } catch (final IOException ioe) { - LOGGER.warn("Unable to cleanly close stream due to " + ioe); + LOGGER.warn("Unable to cleanly close stream", ioe); } finally { consumer.signalEndOfStream(); } @@ -126,7 +126,7 @@ public abstract class AbstractChannelReader implements Runnable { } } catch (final Exception ioe) { closeStream(); - LOGGER.error("Closed channel reader " + this + " due to " + ioe); + LOGGER.error("Closed channel reader {}", this, ioe); } finally { if (buffer != null) { buffer.clear(); diff --git a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelDispatcher.java b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelDispatcher.java index 491ad117c1..e7f46dfe14 100644 --- a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelDispatcher.java +++ b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelDispatcher.java @@ -110,7 +110,7 @@ public final class ChannelDispatcher implements Runnable { } itr.remove(); // do this so that the next select operation returns a positive value; otherwise, it will return 0. if (reader != null && LOGGER.isDebugEnabled()) { - LOGGER.debug(this + " New Connection established. Server channel: " + channel + " Reader: " + reader); + LOGGER.debug("{} New Connection established. Server channel: {} Reader: {}", this, channel, reader); } } } @@ -145,7 +145,7 @@ public final class ChannelDispatcher implements Runnable { reader.setScheduledFuture(readerFuture); } if (reader != null && LOGGER.isDebugEnabled()) { - LOGGER.debug(this + " New Connection established. Server channel: " + channel + " Reader: " + reader); + LOGGER.debug("{} New Connection established. Server channel: {} Reader: {}", this, channel, reader); } } diff --git a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelListener.java b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelListener.java index ab770636eb..51f9a141c5 100644 --- a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelListener.java +++ b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/nio/ChannelListener.java @@ -108,10 +108,8 @@ public final class ChannelListener { ssChannel.setOption(StandardSocketOptions.SO_RCVBUF, receiveBufferSize); final int actualReceiveBufSize = ssChannel.getOption(StandardSocketOptions.SO_RCVBUF); if (actualReceiveBufSize < receiveBufferSize) { - LOGGER.warn(this + " attempted to set TCP Receive Buffer Size to " - + receiveBufferSize + " bytes but could only set to " + actualReceiveBufSize - + "bytes. You may want to consider changing the Operating System's " - + "maximum receive buffer"); + LOGGER.warn("{} attempted to set TCP Receive Buffer Size to {} bytes but could only set to {} bytes. You may want to consider changing the Operating System's maximum receive buffer", + this, receiveBufferSize, actualReceiveBufSize); } } ssChannel.setOption(StandardSocketOptions.SO_REUSEADDR, true); @@ -177,10 +175,8 @@ public final class ChannelListener { dChannel.setOption(StandardSocketOptions.SO_RCVBUF, receiveBufferSize); final int actualReceiveBufSize = dChannel.getOption(StandardSocketOptions.SO_RCVBUF); if (actualReceiveBufSize < receiveBufferSize) { - LOGGER.warn(this + " attempted to set UDP Receive Buffer Size to " - + receiveBufferSize + " bytes but could only set to " + actualReceiveBufSize - + "bytes. You may want to consider changing the Operating System's " - + "maximum receive buffer"); + LOGGER.warn("{} attempted to set UDP Receive Buffer Size to {} bytes but could only set to {} bytes. You may want to consider changing the Operating System's maximum receive buffer", + this, receiveBufferSize, actualReceiveBufSize); } } dChannel.setOption(StandardSocketOptions.SO_REUSEADDR, true); @@ -219,9 +215,11 @@ public final class ChannelListener { LOGGER.warn("Interrupted while trying to shutdown executor"); } final int currentBufferPoolSize = bufferPool.size(); - final String warning = (currentBufferPoolSize != initialBufferPoolSize) ? "Initial buffer count=" + initialBufferPoolSize - + " Current buffer count=" + currentBufferPoolSize - + " Could indicate a buffer leak. Ensure all consumers are executed until they complete." : ""; - LOGGER.info("Channel listener shutdown. " + warning); + if (currentBufferPoolSize != initialBufferPoolSize) { + LOGGER.info("Channel listener shutdown. Initial buffer count={} Current buffer count={} Could indicate a buffer leak. Ensure all consumers are executed until they complete.", + initialBufferPoolSize, currentBufferPoolSize); + } else { + LOGGER.info("Channel listener shutdown."); + } } } diff --git a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketListener.java b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketListener.java index 11837355bb..61a1e81fa8 100644 --- a/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketListener.java +++ b/nifi-commons/nifi-socket-utils/src/main/java/org/apache/nifi/io/socket/SocketListener.java @@ -114,11 +114,11 @@ public abstract class SocketListener { SocketUtils.closeQuietly(socket); continue; } catch (final SocketException se) { - logger.warn("Failed to communicate with " + (socket == null ? "Unknown Host" : socket.getInetAddress().getHostName()) + " due to " + se, se); + logger.warn("Failed to communicate with {}", (socket == null ? "Unknown Host" : socket.getInetAddress().getHostName()), se); SocketUtils.closeQuietly(socket); continue; } catch (final Throwable t) { - logger.warn("Socket Listener encountered exception: " + t, t); + logger.warn("Socket Listener encountered exception", t); SocketUtils.closeQuietly(socket); continue; } @@ -130,14 +130,14 @@ public abstract class SocketListener { try { dispatchRequest(finalSocket); } catch (final Throwable t) { - logger.warn("Dispatching socket request encountered exception due to: " + t, t); + logger.warn("Dispatching socket request encountered exception", t); } finally { SocketUtils.closeQuietly(finalSocket); } } }); } catch (final Throwable t) { - logger.error("Socket Listener encountered exception: " + t, t); + logger.error("Socket Listener encountered exception", t); SocketUtils.closeQuietly(socket); } } @@ -146,7 +146,7 @@ public abstract class SocketListener { t.setName("Cluster Socket Listener"); t.start(); - logger.info("Now listening for connections from nodes on port " + port); + logger.info("Now listening for connections from nodes on port {}", port); } public boolean isRunning() { diff --git a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java index 58de0e00ff..b40c76a1c9 100644 --- a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java +++ b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/FileUtils.java @@ -124,12 +124,12 @@ public class FileUtils { } } if (!isGone && logger != null) { - logger.warn("File appears to exist but unable to delete file: " + file.getAbsolutePath()); + logger.warn("File appears to exist but unable to delete file: {}", file.getAbsolutePath()); } } } catch (final Throwable t) { if (logger != null) { - logger.warn("Unable to delete file: '" + file.getAbsolutePath() + "' due to " + t); + logger.warn("Unable to delete file: '{}'", file.getAbsolutePath(), t); } } return isGone; @@ -167,11 +167,11 @@ public class FileUtils { } } if (!isGone && logger != null) { - logger.warn("File appears to exist but unable to delete file: " + file.getAbsolutePath()); + logger.warn("File appears to exist but unable to delete file: {}", file.getAbsolutePath()); } } catch (final Throwable t) { if (null != logger) { - logger.warn("Unable to delete file given from path: '" + file.getPath() + "' due to " + t); + logger.warn("Unable to delete file given from path: '{}'", file.getPath(), t); } } } @@ -392,7 +392,7 @@ public class FileUtils { FileUtils.deleteFile(destination, null, 5); throw new IOException("Could not remove file " + source.getAbsolutePath()); } else { - logger.warn("Configured to delete source file when renaming/move not successful. However, unable to delete file at: " + source.getAbsolutePath()); + logger.warn("Configured to delete source file when renaming/move not successful. However, unable to delete file at: {}", source.getAbsolutePath()); } } } finally { diff --git a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java index 32edf40c8d..30663e3e29 100644 --- a/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java +++ b/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/file/classloader/ClassLoaderUtils.java @@ -116,7 +116,7 @@ public class ClassLoaderUtils { if (files != null) { for (File classpathResource : files) { if (classpathResource.isDirectory()) { - LOGGER.warn("Recursive directories are not supported, skipping " + classpathResource.getAbsolutePath()); + LOGGER.warn("Recursive directories are not supported, skipping {}", classpathResource.getAbsolutePath()); } else { additionalClasspath.add(classpathResource.toURI().toURL()); } @@ -163,7 +163,7 @@ public class ClassLoaderUtils { lastModified = file.lastModified(); } } catch (URISyntaxException e) { - LOGGER.error("Error getting last modified date for " + url); + LOGGER.error("Error getting last modified date for {}", url); } return lastModified; } diff --git a/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/WebUtils.java b/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/WebUtils.java index 2c3e2b5f6c..b838cf4d44 100644 --- a/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/WebUtils.java +++ b/nifi-commons/nifi-web-utils/src/main/java/org/apache/nifi/web/util/WebUtils.java @@ -175,7 +175,7 @@ public final class WebUtils { verifyContextPath(allowedContextPaths, contextPath); return contextPath; } catch (UriBuilderException e) { - logger.error("Error determining context path on " + jspDisplayName + ": " + e.getMessage()); + logger.error("Error determining context path on {}", jspDisplayName, e); return EMPTY; } } diff --git a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/HashMapSnapshot.java b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/HashMapSnapshot.java index 935beb4705..10ce2aaf45 100644 --- a/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/HashMapSnapshot.java +++ b/nifi-commons/nifi-write-ahead-log/src/main/java/org/apache/nifi/wali/HashMapSnapshot.java @@ -168,6 +168,7 @@ public class HashMapSnapshot implements WriteAheadSnapshot, RecordLookup implements WriteAheadSnapshot, RecordLookup implements WriteAheadSnapshot, RecordLookup implements WriteAheadSnapshot, RecordLookup implements WriteAheadJournal { public void dispose() { logger.debug("Deleting Journal {} because it is now encapsulated in the latest Snapshot", journalFile.getName()); if (!journalFile.delete() && journalFile.exists()) { - logger.warn("Unable to delete expired journal file " + journalFile + "; this file should be deleted manually."); + logger.warn("Unable to delete expired journal file {}; this file should be deleted manually.", journalFile); } if (overflowDirectory.exists()) { final File[] overflowFiles = overflowDirectory.listFiles(); if (overflowFiles == null) { - logger.warn("Unable to obtain listing of files that exist in 'overflow directory' " + overflowDirectory - + " - this directory and any files within it can now be safely removed manually"); + logger.warn("Unable to obtain listing of files that exist in 'overflow directory' {} - this directory and any files within it can now be safely removed manually", overflowDirectory); return; } for (final File overflowFile : overflowFiles) { if (!overflowFile.delete() && overflowFile.exists()) { - logger.warn("After expiring journal file " + journalFile + ", unable to remove 'overflow file' " + overflowFile + " - this file should be removed manually"); + logger.warn("After expiring journal file {}, unable to remove 'overflow file' {} - this file should be removed manually", journalFile, overflowFile); } } if (!overflowDirectory.delete()) { - logger.warn("After expiring journal file " + journalFile + ", unable to remove 'overflow directory' " + overflowDirectory + " - this file should be removed manually"); + logger.warn("After expiring journal file {}, unable to remove 'overflow directory' {} - this file should be removed manually", journalFile, overflowDirectory); } } } @@ -334,7 +333,7 @@ public class LengthDelimitedJournal implements WriteAheadJournal { if (overflowFile != null) { if (!overflowFile.delete() && overflowFile.exists()) { - logger.warn("Failed to cleanup temporary overflow file " + overflowFile + " - this file should be cleaned up manually."); + logger.warn("Failed to cleanup temporary overflow file {} - this file should be cleaned up manually.", overflowFile); } } diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPConsumer.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPConsumer.java index 04f951836a..bc2c79ebd6 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPConsumer.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPConsumer.java @@ -51,7 +51,7 @@ final class AMQPConsumer extends AMQPWorker { this.autoAcknowledge = autoAcknowledge; this.responseQueue = new LinkedBlockingQueue<>(10); - processorLog.info("Successfully connected AMQPConsumer to " + connection.toString() + " and '" + queueName + "' queue"); + processorLog.info("Successfully connected AMQPConsumer to {} and '{}' queue", connection, queueName); final Channel channel = getChannel(); consumer = new DefaultConsumer(channel) { diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPPublisher.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPPublisher.java index fed998cd03..0ab2711af7 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPPublisher.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPPublisher.java @@ -44,7 +44,7 @@ final class AMQPPublisher extends AMQPWorker { getChannel().addReturnListener(new UndeliverableMessageLogger()); this.connectionString = connection.toString(); - processorLog.info("Successfully connected AMQPPublisher to " + this.connectionString); + processorLog.info("Successfully connected AMQPPublisher to {}", this.connectionString); } /** @@ -66,8 +66,7 @@ final class AMQPPublisher extends AMQPWorker { if (exchange.length() == 0) { processorLog.debug("The 'exchangeName' is not specified. Messages will be sent to default exchange"); } - processorLog.debug("Successfully connected AMQPPublisher to " + this.connectionString + " and '" + exchange - + "' exchange with '" + routingKey + "' as a routing key."); + processorLog.debug("Successfully connected AMQPPublisher to {} and '{}' exchange with '{}' as a routing key.", this.connectionString, exchange, routingKey); } try { diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPWorker.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPWorker.java index fca0f50e3e..e621473646 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPWorker.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AMQPWorker.java @@ -52,7 +52,7 @@ abstract class AMQPWorker implements AutoCloseable { try { this.channel = connection.createChannel(); } catch (IOException e) { - processorLog.error("Failed to create Channel for " + connection, e); + processorLog.error("Failed to create Channel for {}", connection, e); throw new IllegalStateException(e); } } @@ -69,7 +69,7 @@ abstract class AMQPWorker implements AutoCloseable { if (channel.isOpen()) { if (processorLog.isDebugEnabled()) { - processorLog.debug("Closing AMQP channel for " + this.channel.getConnection().toString()); + processorLog.debug("Closing AMQP channel for {}", this.channel.getConnection()); } this.channel.close(); diff --git a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java index 0d7838d491..942ce40e69 100644 --- a/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java +++ b/nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/PublishAMQP.java @@ -215,7 +215,7 @@ public class PublishAMQP extends AbstractAMQPProcessor { try { updater.accept(attributeValue); } catch (final Exception e) { - getLogger().warn("Failed to update AMQP Message Property " + attribute, e); + getLogger().warn("Failed to update AMQP Message Property {}", attribute, e); } } diff --git a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java index a577dc3c6b..d5e4294df3 100644 --- a/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java +++ b/nifi-extension-bundles/nifi-asn1-bundle/nifi-asn1-services/src/main/java/org/apache/nifi/jasn1/JASN1Reader.java @@ -279,7 +279,7 @@ public class JASN1Reader extends AbstractConfigurableComponent implements Record Exception parseException = null; for (String asn1File : asnFilePaths) { - logger.info("Parsing " + asn1File); + logger.info("Parsing {}", asn1File); try { AsnModel model = getJavaModelFromAsn1File(asn1File); modulesByName.putAll(model.modulesByName); diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java index 081d86cb26..38475652e6 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-abstract-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/AbstractDynamoDBProcessor.java @@ -243,7 +243,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAwsSyncProcessor flowFile = session.putAttribute(flowFile, DYNAMODB_KEY_ERROR_UNPROCESSED, itemKeys.toString()); session.transfer(flowFile, REL_UNPROCESSED); - getLogger().error("Unprocessed key " + itemKeys + " for flow file " + flowFile); + getLogger().error("Unprocessed key {} for flow file {}", itemKeys, flowFile); keysToFlowFileMap.remove(itemKeys); } @@ -252,7 +252,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAwsSyncProcessor try { validateRangeKeyValue(rangeKeyName, rangeKeyValue); } catch (final IllegalArgumentException e) { - getLogger().error(e.getMessage() + ": " + flowFile, e); + getLogger().error("{}", flowFile, e); flowFile = session.putAttribute(flowFile, DYNAMODB_RANGE_KEY_VALUE_ERROR, "range key '" + rangeKeyName + "'/value '" + rangeKeyValue + "' inconsistency error"); session.transfer(flowFile, REL_FAILURE); @@ -283,7 +283,7 @@ public abstract class AbstractDynamoDBProcessor extends AbstractAwsSyncProcessor try { validateHashKeyValue(hashKeyValue); } catch (final IllegalArgumentException e) { - getLogger().error(e.getMessage() + ": " + flowFile, e); + getLogger().error("{}", flowFile, e); flowFile = session.putAttribute(flowFile, DYNAMODB_HASH_KEY_VALUE_ERROR, "hash key " + hashKeyName + "/value '" + hashKeyValue + "' inconsistency error"); session.transfer(flowFile, REL_FAILURE); isConsistent = false; diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java index 7237ade63c..9f7dda4023 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java @@ -369,7 +369,7 @@ public class AWSCredentialsProviderControllerService extends AbstractControllerS this.context = context; credentialsProvider = createCredentialsProvider(context); - getLogger().debug("Using credentials provider: " + credentialsProvider.getClass()); + getLogger().debug("Using credentials provider: {}", credentialsProvider.getClass()); } private AWSCredentialsProvider createCredentialsProvider(final PropertyContext propertyContext) { diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java index 889228daae..37ff06e95a 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/DeleteDynamoDB.java @@ -159,19 +159,19 @@ public class DeleteDynamoDB extends AbstractDynamoDBProcessor { // All non unprocessed items are successful for (final FlowFile flowFile : keysToFlowFileMap.values()) { - getLogger().debug("Successfully deleted item from dynamodb : " + table); + getLogger().debug("Successfully deleted item from dynamodb : {}", table); session.transfer(flowFile, REL_SUCCESS); } } catch (final AwsServiceException exception) { - getLogger().error("Could not process flowFiles due to service exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to service exception", exception); List failedFlowFiles = processServiceException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (final SdkException exception) { - getLogger().error("Could not process flowFiles due to SDK exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to SDK exception", exception); List failedFlowFiles = processSdkException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (final Exception exception) { - getLogger().error("Could not process flowFiles due to exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles", exception); List failedFlowFiles = processException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java index 165f61b198..ec766cc800 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/GetDynamoDB.java @@ -269,15 +269,15 @@ public class GetDynamoDB extends AbstractDynamoDBProcessor { } } catch (final AwsServiceException exception) { - getLogger().error("Could not process flowFiles due to service exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to service exception", exception); List failedFlowFiles = processServiceException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (final SdkException exception) { - getLogger().error("Could not process flowFiles due to SDK exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to SDK exception", exception); List failedFlowFiles = processSdkException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (final Exception exception) { - getLogger().error("Could not process flowFiles due to exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles", exception); List failedFlowFiles = processException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java index aa6eea6e6b..313142d79c 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDB.java @@ -185,19 +185,19 @@ public class PutDynamoDB extends AbstractDynamoDBProcessor { // Handle any remaining flowfiles for (final FlowFile flowFile : keysToFlowFileMap.values()) { - getLogger().debug("Successful posted items to dynamodb : " + table); + getLogger().debug("Successful posted items to dynamodb : {}", table); session.transfer(flowFile, REL_SUCCESS); } } catch (final AwsServiceException exception) { - getLogger().error("Could not process flowFiles due to service exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to service exception", exception); List failedFlowFiles = processServiceException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (final SdkException exception) { - getLogger().error("Could not process flowFiles due to SDK exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles due to SDK exception", exception); List failedFlowFiles = processSdkException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } catch (Exception exception) { - getLogger().error("Could not process flowFiles due to exception : " + exception.getMessage()); + getLogger().error("Could not process flowFiles", exception); List failedFlowFiles = processException(session, flowFiles, exception); session.transfer(failedFlowFiles, REL_FAILURE); } diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDBRecord.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDBRecord.java index 1db3eaf8cf..15085a04b5 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDBRecord.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/dynamodb/PutDynamoDBRecord.java @@ -210,7 +210,7 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor { final RecordReader reader = recordParserFactory.createRecordReader(flowFile, in, getLogger())) { result = handler.handle(reader.createRecordSet(), alreadyProcessedChunks); } catch (final Exception e) { - getLogger().error("Error while reading records: " + e.getMessage(), e); + getLogger().error("Error while reading records", e); session.transfer(flowFile, REL_FAILURE); return; } @@ -234,7 +234,6 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor { ) { final Throwable error = result.getThrowable(); final Throwable cause = error.getCause(); - final String message = error.getMessage(); if (cause instanceof ProvisionedThroughputExceededException) { // When DynamoDB returns with {@code ProvisionedThroughputExceededException}, the client reached it's write limitation and @@ -243,13 +242,13 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor { context.yield(); session.transfer(outgoingFlowFile, REL_UNPROCESSED); } else if (cause instanceof AwsServiceException) { - getLogger().error("Could not process FlowFile due to server exception: " + message, error); + getLogger().error("Could not process FlowFile due to server exception", error); session.transfer(processServiceException(session, Collections.singletonList(outgoingFlowFile), (AwsServiceException) cause), REL_FAILURE); } else if (cause instanceof SdkException) { - getLogger().error("Could not process FlowFile due to client exception: " + message, error); + getLogger().error("Could not process FlowFile due to client exception", error); session.transfer(processSdkException(session, Collections.singletonList(outgoingFlowFile), (SdkException) cause), REL_FAILURE); } else { - getLogger().error("Could not process FlowFile: " + message, error); + getLogger().error("Could not process FlowFile", error); session.transfer(outgoingFlowFile, REL_FAILURE); } } @@ -378,7 +377,7 @@ public class PutDynamoDBRecord extends AbstractDynamoDBProcessor { sortKeyValue = itemCounter; } else if (SORT_NONE.getValue().equals(sortKeyStrategy)) { - logger.debug("No " + SORT_KEY_STRATEGY.getDisplayName() + " was applied"); + logger.debug("No {} was applied", SORT_KEY_STRATEGY.getDisplayName()); sortKeyValue = null; } else { throw new ProcessException("Unknown " + SORT_KEY_STRATEGY.getDisplayName() + " \"" + sortKeyStrategy + "\""); diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/record/AbstractKinesisRecordProcessor.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/record/AbstractKinesisRecordProcessor.java index fe541f49d0..ace24b71ae 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/record/AbstractKinesisRecordProcessor.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/kinesis/stream/record/AbstractKinesisRecordProcessor.java @@ -271,7 +271,7 @@ public abstract class AbstractKinesisRecordProcessor implements ShardRecordProce } private void checkpointWithRetries(final RecordProcessorCheckpointer checkpointer) { - log.debug("Checkpointing shard " + kinesisShardId); + log.debug("Checkpointing shard {}", kinesisShardId); try { for (int i = 0; i < numRetries; i++) { if (attemptCheckpoint(checkpointer, i)) { diff --git a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java index 338834436b..baeee681c1 100644 --- a/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java +++ b/nifi-extension-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/s3/PutS3Object.java @@ -684,8 +684,7 @@ public class PutS3Object extends AbstractS3Processor { ffFilename, bucket, key); } } catch (IOException e) { - getLogger().error("IOException initiating cache state while processing flow files: " + - e.getMessage()); + getLogger().error("IOException initiating cache state while processing flow files", e); throw (e); } @@ -720,12 +719,10 @@ public class PutS3Object extends AbstractS3Processor { try { persistLocalState(cacheKey, currentState); } catch (Exception e) { - getLogger().info("Exception saving cache state while processing flow file: " + - e.getMessage()); + getLogger().info("Exception saving cache state while processing flow file", e); throw (new ProcessException("Exception saving cache state", e)); } - getLogger().info("Success initiating upload flowfile={} available={} position={} " + - "length={} bucket={} key={} uploadId={}", + getLogger().info("Success initiating upload flowfile={} available={} position={} length={} bucket={} key={} uploadId={}", ffFilename, in.available(), currentState.getFilePosition(), currentState.getContentLength(), bucket, key, currentState.getUploadId()); @@ -782,8 +779,7 @@ public class PutS3Object extends AbstractS3Processor { try { persistLocalState(cacheKey, currentState); } catch (Exception e) { - getLogger().info("Exception saving cache state processing flow file: " + - e.getMessage()); + getLogger().info("Exception saving cache state processing flow file", e); } int available = 0; try { @@ -838,7 +834,7 @@ public class PutS3Object extends AbstractS3Processor { } } } catch (IOException e) { - getLogger().error("Error during upload of flow files: " + e.getMessage()); + getLogger().error("Error during upload of flow files", e); throw e; } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-parameter-providers/src/main/java/org/apache/nifi/parameter/azure/AzureKeyVaultSecretsParameterProvider.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-parameter-providers/src/main/java/org/apache/nifi/parameter/azure/AzureKeyVaultSecretsParameterProvider.java index 45bc98c4d2..fbd01c49d4 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-parameter-providers/src/main/java/org/apache/nifi/parameter/azure/AzureKeyVaultSecretsParameterProvider.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-parameter-providers/src/main/java/org/apache/nifi/parameter/azure/AzureKeyVaultSecretsParameterProvider.java @@ -147,8 +147,7 @@ public class AzureKeyVaultSecretsParameterProvider extends AbstractParameterProv } final String parameterGroupName = tags.get(GROUP_NAME_TAG); if (parameterGroupName == null) { - getLogger().debug("Secret with parameter name [{}] not recognized as a valid parameter since it " + - "does not have the [{}] tag", parameterName, GROUP_NAME_TAG); + getLogger().debug("Secret with parameter name [{}] not recognized as a valid parameter since it does not have the [{}] tag", parameterName, GROUP_NAME_TAG); continue; } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java index 57a42bf295..b235a97480 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/ConsumeAzureEventHub.java @@ -594,7 +594,8 @@ public class ConsumeAzureEventHub extends AbstractSessionFactoryProcessor implem errorMessage = "Receive Events failed"; } - getLogger().error(errorMessage + ". Namespace [{}] Event Hub [{}] Consumer Group [{}] Partition [{}]", + getLogger().error("{}. Namespace [{}] Event Hub [{}] Consumer Group [{}] Partition [{}]", + errorMessage, partitionContext.getFullyQualifiedNamespace(), partitionContext.getEventHubName(), partitionContext.getConsumerGroup(), diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/checkpoint/ComponentStateCheckpointStore.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/checkpoint/ComponentStateCheckpointStore.java index 7695b1c717..c8fcc9ee8b 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/checkpoint/ComponentStateCheckpointStore.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/eventhub/checkpoint/ComponentStateCheckpointStore.java @@ -295,7 +295,7 @@ public class ComponentStateCheckpointStore implements CheckpointStore { private void debug(String message, Object... arguments) { if (LOGGER.isDebugEnabled()) { - LOGGER.debug("[clientId={}] " + message, ArrayUtils.addFirst(arguments, clientId)); + LOGGER.debug("[clientId={}] {}", ArrayUtils.addFirst(arguments, clientId), message); } } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AbstractStorageClientFactory.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AbstractStorageClientFactory.java index 0c9d9df111..797b1b3340 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AbstractStorageClientFactory.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AbstractStorageClientFactory.java @@ -54,7 +54,7 @@ abstract class AbstractStorageClientFactory { */ public CLIENT getStorageClient(final CREDENTIAL credentialsDetails) { return clientCache.get(credentialsDetails, __ -> { - logger.debug(credentialsDetails.getClass().getSimpleName() + " is not found in the cache with the given credentials. Creating it."); + logger.debug("{} is not found in the cache with the given credentials. Creating it.", credentialsDetails.getClass().getSimpleName()); return createStorageClient(credentialsDetails, proxyOptions); }); } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/cosmos/document/AzureCosmosDBClientService.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/cosmos/document/AzureCosmosDBClientService.java index 440614a941..1963c56409 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/cosmos/document/AzureCosmosDBClientService.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/services/azure/cosmos/document/AzureCosmosDBClientService.java @@ -68,7 +68,7 @@ public class AzureCosmosDBClientService extends AbstractControllerService implem try { cosmosClient.close(); } catch (CosmosException e) { - getLogger().error("Closing cosmosClient Failed: " + e.getMessage(), e); + getLogger().error("Closing cosmosClient Failed", e); } finally { this.cosmosClient = null; } diff --git a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java index 25da596c18..afd1b776c6 100644 --- a/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java +++ b/nifi-extension-bundles/nifi-azure-bundle/nifi-azure-reporting-task/src/main/java/org/apache/nifi/reporting/azure/loganalytics/AzureLogAnalyticsProvenanceReportingTask.java @@ -330,7 +330,7 @@ public class AzureLogAnalyticsProvenanceReportingTask extends AbstractAzureLogAn final HttpPost httpPost = new HttpPost(dataCollectorEndpoint); httpPost.addHeader("Content-Type", "application/json"); httpPost.addHeader("Log-Type", logName); - getLogger().debug("Sending " + batchSize + " events of length " + str.length() + " to azure log analytics " + logName); + getLogger().debug("Sending {} events of length {} to azure log analytics {}", batchSize, str.length(), logName); try { sendToLogAnalytics(httpPost, workspaceId, linuxPrimaryKey, str); diff --git a/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java b/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java index 9d158eb8b2..ea5b830be4 100644 --- a/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java +++ b/nifi-extension-bundles/nifi-cdc/nifi-cdc-mysql-bundle/nifi-cdc-mysql-processors/src/main/java/org/apache/nifi/cdc/mysql/processors/CaptureChangeMySQL.java @@ -714,7 +714,7 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor { // If there's no exception, the listener callback might not have been executed yet, so try again later. Otherwise clean up and start over next time if (e != null) { // Communications failure, disconnect and try next time - log.error("Binlog connector communications failure: " + e.getMessage(), e); + log.error("Binlog connector communications failure", e); try { stop(); } catch (CDCException ioe) { @@ -1312,7 +1312,7 @@ public class CaptureChangeMySQL extends AbstractSessionFactoryProcessor { getLogger().trace("Closing the pooled JDBC connection."); connection.close(); } catch (SQLException e) { - getLogger().warn("Failed to close JDBC connection due to " + e, e); + getLogger().warn("Failed to close JDBC connection", e); } } } diff --git a/nifi-extension-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java b/nifi-extension-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java index cb446f9dfc..80e2417768 100644 --- a/nifi-extension-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java +++ b/nifi-extension-bundles/nifi-confluent-platform-bundle/nifi-confluent-schema-registry-service/src/main/java/org/apache/nifi/confluent/schemaregistry/client/RestSchemaRegistryClient.java @@ -144,14 +144,14 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient { completeSchema = postJsonResponse("/subjects/" + searchName, schemaJson, "schema id: " + schemaId); break; } catch (SchemaNotFoundException e) { - logger.debug("Could not find schema in registry by subject name " + searchName, e); + logger.debug("Could not find schema in registry by subject name {}", searchName, e); continue; } } } } catch (SchemaNotFoundException e) { - logger.debug("Could not find schema metadata in registry by id and subjects in: " + schemaPath); + logger.debug("Could not find schema metadata in registry by id and subjects in: {}", schemaPath); } // Get all couples (subject name, version) for a given schema ID @@ -179,7 +179,7 @@ public class RestSchemaRegistryClient implements SchemaRegistryClient { } } } catch (SchemaNotFoundException e) { - logger.debug("Could not find schema metadata in registry by id and versions in: " + schemaPath); + logger.debug("Could not find schema metadata in registry by id and versions in: {}", schemaPath); } } diff --git a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java index bb4e4d7136..19a1241c12 100644 --- a/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java +++ b/nifi-extension-bundles/nifi-evtx-bundle/nifi-evtx-processors/src/main/java/org/apache/nifi/processors/evtx/parser/ChunkHeader.java @@ -102,13 +102,13 @@ public class ChunkHeader extends Block { while (offset > 0) { int token = new BinaryReader(binaryReader, offset - 10).read(); if (token != 0x0c) { - log.warn("Unexpected token when parsing template at offset " + offset); + log.warn("Unexpected token when parsing template at offset {}", offset); break; } BinaryReader templateReader = new BinaryReader(binaryReader, offset - 4); int pointer = NumberUtil.intValueMax(templateReader.readDWord(), Integer.MAX_VALUE, "Invalid pointer."); if (offset != pointer) { - log.warn("Invalid pointer when parsing template at offset " + offset); + log.warn("Invalid pointer when parsing template at offset {}", offset); break; } TemplateNode templateNode = new TemplateNode(templateReader, this); diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-bin-manager/src/main/java/org/apache/nifi/processor/util/bin/Bin.java b/nifi-extension-bundles/nifi-extension-utils/nifi-bin-manager/src/main/java/org/apache/nifi/processor/util/bin/Bin.java index f702545e6d..30797de200 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-bin-manager/src/main/java/org/apache/nifi/processor/util/bin/Bin.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-bin-manager/src/main/java/org/apache/nifi/processor/util/bin/Bin.java @@ -183,7 +183,7 @@ public class Bin { final String index = flowFile.getAttribute(FRAGMENT_INDEX_ATTRIBUTE); if (index == null || index.isEmpty() || !binIndexSet.add(index)) { // Do not accept flowfile with duplicate fragment index value - logger.warn("Duplicate or missing value for '" + FRAGMENT_INDEX_ATTRIBUTE + "' in defragment mode. Flowfile {} not allowed in Bin", flowFile); + logger.warn("Duplicate or missing value for '{}' in defragment mode. Flowfile {} not allowed in Bin", FRAGMENT_INDEX_ATTRIBUTE, flowFile); successiveFailedOfferings++; return false; } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/dispatcher/DatagramChannelDispatcher.java b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/dispatcher/DatagramChannelDispatcher.java index 0dd111ec1d..e66ea7d1bc 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/dispatcher/DatagramChannelDispatcher.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-event-listen/src/main/java/org/apache/nifi/processor/util/listen/dispatcher/DatagramChannelDispatcher.java @@ -84,9 +84,8 @@ public class DatagramChannelDispatcher> impleme datagramChannel.setOption(StandardSocketOptions.SO_RCVBUF, maxBufferSize); final int actualReceiveBufSize = datagramChannel.getOption(StandardSocketOptions.SO_RCVBUF); if (actualReceiveBufSize < maxBufferSize) { - logger.warn("Attempted to set Socket Buffer Size to " + maxBufferSize + " bytes but could only set to " - + actualReceiveBufSize + "bytes. You may want to consider changing the Operating System's " - + "maximum receive buffer"); + logger.warn("Attempted to set Socket Buffer Size to {} bytes but could only set to {} bytes. You may want to consider changing the Operating System's maximum receive buffer", + maxBufferSize, actualReceiveBufSize); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/PutFileTransfer.java b/nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/PutFileTransfer.java index 57a4a99156..cfbb0aa3e7 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/PutFileTransfer.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-file-transfer/src/main/java/org/apache/nifi/processor/util/file/transfer/PutFileTransfer.java @@ -251,7 +251,7 @@ public abstract class PutFileTransfer extends AbstractPr destinationRelationship = REL_REJECT; transferFile = false; penalizeFile = false; - logger.warn("Could not determine a unique name after 99 attempts for. Switching resolution mode to REJECT for " + flowFile); + logger.warn("Could not determine a unique name after 99 attempts for. Switching resolution mode to REJECT for {}", flowFile); } break; case FileTransfer.CONFLICT_RESOLUTION_IGNORE: diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java index 2b2ee8e98b..431bb9938a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/AbstractHadoopProcessor.java @@ -406,7 +406,7 @@ public abstract class AbstractHadoopProcessor extends AbstractProcessor implemen try { statsThread.interrupt(); } catch (Exception e) { - getLogger().warn("Error interrupting thread: " + e.getMessage(), e); + getLogger().warn("Error interrupting thread", e); } } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/HDFSResourceHelper.java b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/HDFSResourceHelper.java index 18650ac33e..4f3239a185 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/HDFSResourceHelper.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-hadoop-utils/src/main/java/org/apache/nifi/processors/hadoop/HDFSResourceHelper.java @@ -34,14 +34,14 @@ public final class HDFSResourceHelper { try { interruptStatisticsThread(fileSystem); } catch (Exception e) { - LOGGER.warn("Error stopping FileSystem statistics thread: " + e.getMessage()); + LOGGER.warn("Error stopping FileSystem statistics thread", e); LOGGER.debug("", e); } finally { if (fileSystem != null) { try { fileSystem.close(); } catch (IOException e) { - LOGGER.warn("Error close FileSystem: " + e.getMessage(), e); + LOGGER.warn("Error close FileSystem", e); } } } @@ -64,7 +64,7 @@ public final class HDFSResourceHelper { try { statsThread.interrupt(); } catch (Exception e) { - LOGGER.warn("Error interrupting thread: " + e.getMessage(), e); + LOGGER.warn("Error interrupting thread", e); } } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java index 0e47fc340d..d09950c52a 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-listed-entity/src/main/java/org/apache/nifi/processor/util/list/AbstractListProcessor.java @@ -645,8 +645,8 @@ public abstract class AbstractListProcessor extends Ab upperBoundExclusiveTimestamp = currentTime - listingLagMillis; if (getLogger().isTraceEnabled()) { - getLogger().trace("interval: " + lowerBoundInclusiveTimestamp + " - " + upperBoundExclusiveTimestamp); - getLogger().trace("entityList: " + entityList.stream().map(entity -> entity.getName() + "_" + entity.getTimestamp()).collect(Collectors.joining(", "))); + getLogger().trace("interval: {} - {}", lowerBoundInclusiveTimestamp, upperBoundExclusiveTimestamp); + getLogger().trace("entityList: {}", entityList.stream().map(entity -> entity.getName() + "_" + entity.getTimestamp()).collect(Collectors.joining(", "))); } entityList .stream() @@ -658,7 +658,7 @@ public abstract class AbstractListProcessor extends Ab ); if (getLogger().isTraceEnabled()) { - getLogger().trace("orderedEntries: " + + getLogger().trace("orderedEntries: {}", orderedEntries.values().stream() .flatMap(List::stream) .map(entity -> entity.getName() + "_" + entity.getTimestamp()) @@ -692,13 +692,12 @@ public abstract class AbstractListProcessor extends Ab try { if (getLogger().isTraceEnabled()) { - getLogger().info("this.lastListedLatestEntryTimestampMillis = upperBoundExclusiveTimestamp: " + lastListedLatestEntryTimestampMillis + " = " + upperBoundExclusiveTimestamp); + getLogger().info("this.lastListedLatestEntryTimestampMillis = upperBoundExclusiveTimestamp: {} = {}", lastListedLatestEntryTimestampMillis, upperBoundExclusiveTimestamp); } lastListedLatestEntryTimestampMillis = upperBoundExclusiveTimestamp; persist(upperBoundExclusiveTimestamp, upperBoundExclusiveTimestamp, latestIdentifiersProcessed, session, getStateScope(context)); } catch (final IOException ioe) { - getLogger().warn("Unable to save state due to {}. If NiFi is restarted before state is saved, or " - + "if another node begins executing this Processor, data duplication may occur.", ioe); + getLogger().warn("Unable to save state due to {}. If NiFi is restarted before state is saved, or if another node begins executing this Processor, data duplication may occur.", ioe); } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java index 114948e2ba..a7db224fe7 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-avro-record-utils/src/main/java/org/apache/nifi/avro/AvroTypeUtil.java @@ -948,7 +948,7 @@ public class AvroTypeUtil { values.put(fieldName, coercedValue); } catch (Exception ex) { - logger.debug("fail to convert field " + fieldName, ex ); + logger.debug("fail to convert field {}", fieldName, ex ); throw ex; } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/record/listen/SocketChannelRecordReaderDispatcher.java b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/record/listen/SocketChannelRecordReaderDispatcher.java index e981322425..6c20a95610 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/record/listen/SocketChannelRecordReaderDispatcher.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-record-utils/nifi-standard-record-utils/src/main/java/org/apache/nifi/record/listen/SocketChannelRecordReaderDispatcher.java @@ -126,7 +126,7 @@ public class SocketChannelRecordReaderDispatcher implements Runnable, Closeable recordReaders.offer(socketChannelRecordReader); } catch (Exception e) { - logger.error("Error dispatching connection: " + e.getMessage(), e); + logger.error("Error dispatching connection", e); } } } diff --git a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/provenance/ProvenanceEventConsumer.java b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/provenance/ProvenanceEventConsumer.java index cf3c5e6263..aaae33b21c 100644 --- a/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/provenance/ProvenanceEventConsumer.java +++ b/nifi-extension-bundles/nifi-extension-utils/nifi-reporting-utils/src/main/java/org/apache/nifi/reporting/util/provenance/ProvenanceEventConsumer.java @@ -166,7 +166,7 @@ public class ProvenanceEventConsumer { try { state = stateManager.getState(Scope.LOCAL).toMap(); } catch (IOException e) { - logger.error("Failed to get state at start up due to:" + e.getMessage(), e); + logger.error("Failed to get state at start up", e); return; } @@ -202,7 +202,7 @@ public class ProvenanceEventConsumer { rawEvents = eventAccess.getProvenanceEvents(firstEventId, batchSize); filteredEvents = filterEvents(componentMapHolder, rawEvents); } catch (final IOException ioe) { - logger.error("Failed to retrieve Provenance Events from repository due to: " + ioe.getMessage(), ioe); + logger.error("Failed to retrieve Provenance Events from repository", ioe); return; } @@ -226,7 +226,7 @@ public class ProvenanceEventConsumer { rawEvents = eventAccess.getProvenanceEvents(firstEventId, batchSize); filteredEvents = filterEvents(componentMapHolder, rawEvents); } catch (final IOException ioe) { - logger.error("Failed to retrieve Provenance Events from repository due to: " + ioe.getMessage(), ioe); + logger.error("Failed to retrieve Provenance Events from repository", ioe); return; } } diff --git a/nifi-extension-bundles/nifi-geohash-bundle/nifi-geohash-processors/src/main/java/org/apache/nifi/processors/geohash/GeohashRecord.java b/nifi-extension-bundles/nifi-geohash-bundle/nifi-geohash-processors/src/main/java/org/apache/nifi/processors/geohash/GeohashRecord.java index dc45522015..5ef0dcf59e 100644 --- a/nifi-extension-bundles/nifi-geohash-bundle/nifi-geohash-processors/src/main/java/org/apache/nifi/processors/geohash/GeohashRecord.java +++ b/nifi-extension-bundles/nifi-geohash-bundle/nifi-geohash-processors/src/main/java/org/apache/nifi/processors/geohash/GeohashRecord.java @@ -339,7 +339,7 @@ public class GeohashRecord extends AbstractProcessor { } } catch (IllegalArgumentException e) { //lat/lon/geohash values out of range or is not valid - getLogger().warn("Unable to " + (encode ? "encode" : "decode"), e); + getLogger().warn("Unable to {}", (encode ? "encode" : "decode"), e); } routingStrategyExecutor.writeFlowFiles(record, writer, notMatchedWriter, updated); diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java index 141097c14d..9049266981 100644 --- a/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java +++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-graph-processors/src/main/java/org/apache/nifi/processors/graph/ExecuteGraphQueryRecord.java @@ -249,7 +249,7 @@ public class ExecuteGraphQueryRecord extends AbstractGraphExecutor { graphOutputStream.close(); session.transfer(graph, GRAPH); } catch (Exception e) { - getLogger().error("Error processing record at index " + records, e); + getLogger().error("Error processing record at index {}", records, e); // write failed records to a flowfile destined for the failure relationship failedWriter.write(record); session.remove(graph); diff --git a/nifi-extension-bundles/nifi-graph-bundle/nifi-neo4j-cypher-service/src/main/java/org/apache/nifi/graph/Neo4JCypherClientService.java b/nifi-extension-bundles/nifi-graph-bundle/nifi-neo4j-cypher-service/src/main/java/org/apache/nifi/graph/Neo4JCypherClientService.java index 2a9fbd348f..be7b018bc7 100644 --- a/nifi-extension-bundles/nifi-graph-bundle/nifi-neo4j-cypher-service/src/main/java/org/apache/nifi/graph/Neo4JCypherClientService.java +++ b/nifi-extension-bundles/nifi-graph-bundle/nifi-neo4j-cypher-service/src/main/java/org/apache/nifi/graph/Neo4JCypherClientService.java @@ -235,7 +235,7 @@ public class Neo4JCypherClientService extends AbstractControllerService implemen try { neo4JDriver = getDriver(context); } catch (Exception e) { - getLogger().error("Error while getting connection " + e.getLocalizedMessage(), e); + getLogger().error("Error while getting connection", e); throw new ProcessException("Error while getting connection" + e.getLocalizedMessage(), e); } getLogger().info("Neo4JCypherExecutor connection created for url {}", connectionUrl); diff --git a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java index 669f5d0a24..c0c604e781 100644 --- a/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java +++ b/nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java @@ -261,13 +261,13 @@ public class ExecuteGroovyScript extends AbstractProcessor { //compile if needed getGroovyScript(); } catch (Throwable t) { - getLogger().error("Load script failed: " + t); + getLogger().error("Load script failed", t); throw new ProcessException("Load script failed: " + t, t); } try { callScriptStatic("onStart", context); } catch (Throwable t) { - getLogger().error("onStart failed: " + t); + getLogger().error("onStart failed", t); throw new ProcessException("onStart failed: " + t, t); } } @@ -361,7 +361,7 @@ public class ExecuteGroovyScript extends AbstractProcessor { } } } catch (Throwable ei) { - getLogger().warn("Failed to set autocommit=false for `" + e.getKey() + "`", ei); + getLogger().warn("Failed to set autocommit=false for `{}`", e.getKey(), ei); } e.setValue(sql); } @@ -394,7 +394,7 @@ public class ExecuteGroovyScript extends AbstractProcessor { } } } catch (Throwable ei) { - getLogger().warn("Failed to set autocommit=true for `" + e.getKey() + "`", ei); + getLogger().warn("Failed to set autocommit=true for `{}`", e.getKey(), ei); } try { sql.close(); diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/flow/resource/hadoop/HDFSExternalResourceProvider.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/flow/resource/hadoop/HDFSExternalResourceProvider.java index 8c4d7b7630..6f89bd88ab 100644 --- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/flow/resource/hadoop/HDFSExternalResourceProvider.java +++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/flow/resource/hadoop/HDFSExternalResourceProvider.java @@ -120,7 +120,7 @@ public class HDFSExternalResourceProvider implements ExternalResourceProvider { .collect(Collectors.toList()); if (LOGGER.isDebugEnabled()) { - LOGGER.debug("The following NARs were found: " + String.join(", ", result.stream().map(d -> d.getLocation()).collect(Collectors.toList()))); + LOGGER.debug("The following NARs were found: {}", String.join(", ", result.stream().map(d -> d.getLocation()).collect(Collectors.toList()))); } return result; diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java index 3984508e5a..a87398d83e 100644 --- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java +++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFS.java @@ -486,7 +486,7 @@ public class GetHDFS extends AbstractHadoopProcessor { files.add(canonicalFile); if (getLogger().isDebugEnabled()) { - getLogger().debug(this + " selected file at path: " + canonicalFile.toString()); + getLogger().debug("{} selected file at path: {}", this, canonicalFile); } } diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFSSequenceFile.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFSSequenceFile.java index 635a910212..b58e5b676b 100644 --- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFSSequenceFile.java +++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/GetHDFSSequenceFile.java @@ -107,7 +107,7 @@ public class GetHDFSSequenceFile extends GetHDFS { logger.debug("Reading file"); flowFiles = getFlowFiles(conf, hdfs, reader, file); if (!keepSourceFiles && !hdfs.delete(file, false)) { - logger.warn("Unable to delete path " + file.toString() + " from HDFS. Will likely be picked up over and over..."); + logger.warn("Unable to delete path {} from HDFS. Will likely be picked up over and over...", file); } } catch (Throwable t) { final String errorString = "Error retrieving file {} from HDFS due to {}"; diff --git a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java index 52b3a59d2e..fbd3cc785e 100644 --- a/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java +++ b/nifi-extension-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/MoveHDFS.java @@ -514,7 +514,7 @@ public class MoveHDFS extends AbstractHadoopProcessor { files.add(canonicalFile); if (getLogger().isDebugEnabled()) { - getLogger().debug(this + " selected file at path: " + canonicalFile.toString()); + getLogger().debug("{} selected file at path: {}", this, canonicalFile); } } } diff --git a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java index 9ec7de1418..ebca07e2a7 100644 --- a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java +++ b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java @@ -104,14 +104,14 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement cache = hazelcastCacheManager.getCache( context.getProperty(HAZELCAST_CACHE_NAME).evaluateAttributeExpressions().getValue(), context.getProperty(HAZELCAST_ENTRY_TTL).asTimePeriod(TimeUnit.MILLISECONDS)); - getLogger().debug("Enable Hazelcast cache client for cache " + cache.name()); + getLogger().debug("Enable Hazelcast cache client for cache {}", cache.name()); } @OnDisabled public void onDisabled() { if (cache != null) { // The cache state will be preserved until the Service is not stopped! - getLogger().debug("Disable Hazelcast cache client for cache " + cache.name()); + getLogger().debug("Disable Hazelcast cache client for cache {}", cache.name()); cache = null; } } @@ -135,11 +135,12 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement if (oldValue == null && (!entry.getRevision().isPresent() || entry.getRevision().get() < STARTING_REVISION)) { cache.put(key, serialize(entry.getValue(), valueSerializer, STARTING_REVISION)); - getLogger().debug("Entry with key " + key + " was added during replace"); + getLogger().debug("Entry with key {} was added during replace", key); return true; } else if (oldValue != null && Objects.equals(entry.getRevision().get(), parseRevision(oldValue))) { - cache.put(key, serialize(entry.getValue(), valueSerializer, entry.getRevision().get() + 1)); - getLogger().debug("Entry with key " + key + " was updated during replace, with revision " + entry.getRevision().get() + 1); + final long newRevision = entry.getRevision().get() + 1; + cache.put(key, serialize(entry.getValue(), valueSerializer, newRevision)); + getLogger().debug("Entry with key {} was updated during replace, with revision {}", key, newRevision); return true; } } diff --git a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cachemanager/IMapBasedHazelcastCacheManager.java b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cachemanager/IMapBasedHazelcastCacheManager.java index 0d8e8cf21d..fc22c020ef 100644 --- a/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cachemanager/IMapBasedHazelcastCacheManager.java +++ b/nifi-extension-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cachemanager/IMapBasedHazelcastCacheManager.java @@ -68,7 +68,7 @@ abstract class IMapBasedHazelcastCacheManager extends AbstractControllerService try { instance = getInstance(context); } catch (final Exception e) { - getLogger().error("Could not create Hazelcast instance. Reason: " + e.getMessage(), e); + getLogger().error("Could not create Hazelcast instance.", e); // In case of bind exception, we provide a more specific error message to avoid ambiguity if (e.getCause() instanceof BindException && e.getCause().getMessage().equals("Address already in use")) { diff --git a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseCell.java b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseCell.java index 2dc0ee8891..4c30175af0 100644 --- a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseCell.java +++ b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseCell.java @@ -86,7 +86,7 @@ public class PutHBaseCell extends AbstractPutHBase { try { timestamp = Long.valueOf(timestampValue); } catch (Exception e) { - getLogger().error("Invalid timestamp value: " + timestampValue, e); + getLogger().error("Invalid timestamp value: {}", timestampValue, e); return null; } } else { 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 62e04241e5..4962a51d0d 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 @@ -172,7 +172,7 @@ public class PutHBaseJSON extends AbstractPutHBase { try { timestamp = Long.valueOf(timestampValue); } catch (Exception e) { - getLogger().error("Invalid timestamp value: " + timestampValue, e); + getLogger().error("Invalid timestamp value: {}", timestampValue, e); return null; } } else { diff --git a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseRecord.java b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseRecord.java index 0ed52e6e1e..2ce8fcece2 100644 --- a/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseRecord.java +++ b/nifi-extension-bundles/nifi-hbase-bundle/nifi-hbase-processors/src/main/java/org/apache/nifi/hbase/PutHBaseRecord.java @@ -402,7 +402,7 @@ public class PutHBaseRecord extends AbstractPutHBase { } if (timestamp == null) { - getLogger().warn("The value of timestamp field " + timestampFieldName + " was null, record will be inserted with latest timestamp"); + getLogger().warn("The value of timestamp field {} was null, record will be inserted with latest timestamp", timestampFieldName); } } else { timestamp = null; diff --git a/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java b/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java index 8fcc8ac7d4..01bf3638d5 100644 --- a/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java +++ b/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/AbstractIcebergProcessor.java @@ -115,7 +115,7 @@ public abstract class AbstractIcebergProcessor extends AbstractProcessor impleme }); } catch (Exception e) { - getLogger().error("Privileged action failed with kerberos user " + kerberosUser, e); + getLogger().error("Privileged action failed with kerberos user {}", kerberosUser, e); session.transfer(session.penalize(flowFile), REL_FAILURE); } } diff --git a/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/converter/IcebergRecordConverter.java b/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/converter/IcebergRecordConverter.java index 42efadc07d..d4b504f3e4 100644 --- a/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/converter/IcebergRecordConverter.java +++ b/nifi-extension-bundles/nifi-iceberg-bundle/nifi-iceberg-common/src/main/java/org/apache/nifi/processors/iceberg/converter/IcebergRecordConverter.java @@ -177,7 +177,7 @@ public class IcebergRecordConverter { if (mappedFieldName.isEmpty()) { if (UnmatchedColumnBehavior.WARNING_UNMATCHED_COLUMN.equals(unmatchedColumnBehavior)) { if (logger != null) { - logger.warn("Cannot find field with name '" + name + "' in the record schema, using the target schema for datatype and a null value"); + logger.warn("Cannot find field with name '{}' in the record schema, using the target schema for datatype and a null value", name); } } // If the field is missing, use the expected type from the schema (converted to a DataType) diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryHandler.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryHandler.java index 7169d89418..b55dc76d0f 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryHandler.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/cf/JMSConnectionFactoryHandler.java @@ -62,9 +62,9 @@ public class JMSConnectionFactoryHandler extends CachedJMSConnectionFactoryHandl public ConnectionFactory createConnectionFactory() { try { if (logger.isInfoEnabled()) { - logger.info("Configuring " + getClass().getSimpleName() + " for '" - + context.getProperty(JMS_CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue() + "' to be connected to '" - + context.getProperty(JMS_BROKER_URI).evaluateAttributeExpressions().getValue() + "'"); + logger.info("Configuring {} for '{}' to be connected to '{}'", getClass().getSimpleName(), + context.getProperty(JMS_CONNECTION_FACTORY_IMPL).evaluateAttributeExpressions().getValue(), + context.getProperty(JMS_BROKER_URI).evaluateAttributeExpressions().getValue()); } final ConnectionFactory connectionFactory = createConnectionFactoryInstance(); @@ -72,7 +72,7 @@ public class JMSConnectionFactoryHandler extends CachedJMSConnectionFactoryHandl return connectionFactory; } catch (Exception e) { - logger.error("Failed to configure " + getClass().getSimpleName(), e); + logger.error("Failed to configure {}", getClass().getSimpleName(), e); throw new IllegalStateException(e); } } diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/AbstractJMSProcessor.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/AbstractJMSProcessor.java index e66c795438..0d98616871 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/AbstractJMSProcessor.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/AbstractJMSProcessor.java @@ -222,7 +222,7 @@ public abstract class AbstractJMSProcessor extends Abstract connectionFactoryProvider.resetConnectionFactory(currentCF.getTargetConnectionFactory()); worker = buildTargetResource(context); } catch (Exception e) { - getLogger().error("Failed to rebuild: " + connectionFactoryProvider); + getLogger().error("Failed to rebuild: {}", connectionFactoryProvider); worker = null; } } diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java index 4c43997ee6..70f7fa4824 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSConsumer.java @@ -277,7 +277,7 @@ class JMSConsumer extends JMSWorker { destinationName = (destination instanceof Queue) ? ((Queue) destination).getQueueName() : ((Topic) destination).getTopicName(); } catch (JMSException e) { - this.processLog.warn("Failed to retrieve Destination name for '" + headerName + "' header", e); + this.processLog.warn("Failed to retrieve Destination name for '{}' header", headerName, e); } } return destinationName; diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSPublisher.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSPublisher.java index 8da1561080..8d301bbbf8 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSPublisher.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/JMSPublisher.java @@ -132,8 +132,7 @@ class JMSPublisher extends JMSWorker { .setProperty(message, entry.getKey(), entry.getValue()); } } catch (NumberFormatException ne) { - this.processLog.warn("Incompatible value for attribute " + entry.getKey() - + " [" + entry.getValue() + "] is not a number. Ignoring this attribute."); + this.processLog.warn("Incompatible value for attribute {} [{}] is not a number. Ignoring this attribute.", entry.getKey(), entry.getValue()); } } } diff --git a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/PublishJMS.java b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/PublishJMS.java index 5dcf750a94..411fb404ff 100644 --- a/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/PublishJMS.java +++ b/nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/PublishJMS.java @@ -283,7 +283,7 @@ public class PublishJMS extends AbstractJMSProcessor { private void handleException(ProcessContext context, ProcessSession processSession, JMSPublisher publisher, FlowFile flowFile, Exception e) { processSession.transfer(flowFile, REL_FAILURE); - this.getLogger().error("Failed while sending message to JMS via " + publisher, e); + this.getLogger().error("Failed while sending message to JMS via {}", publisher, e); context.yield(); publisher.setValid(false); } diff --git a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-2-6-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumerPool.java b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-2-6-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumerPool.java index 0a587902f0..9d3e9bf0e4 100644 --- a/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-2-6-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumerPool.java +++ b/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-2-6-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/ConsumerPool.java @@ -615,13 +615,13 @@ public class ConsumerPool implements Closeable { try { consumer.unsubscribe(); } catch (Exception e) { - logger.warn("Failed while unsubscribing " + consumer, e); + logger.warn("Failed while unsubscribing {}", consumer, e); } try { consumer.close(); } catch (Exception e) { - logger.warn("Failed while closing " + consumer, e); + logger.warn("Failed while closing {}", consumer, e); } } diff --git a/nifi-extension-bundles/nifi-kerberos-iaa-providers-bundle/nifi-kerberos-iaa-providers/src/main/java/org/apache/nifi/kerberos/KerberosProvider.java b/nifi-extension-bundles/nifi-kerberos-iaa-providers-bundle/nifi-kerberos-iaa-providers/src/main/java/org/apache/nifi/kerberos/KerberosProvider.java index bfbb711990..a467a3877b 100644 --- a/nifi-extension-bundles/nifi-kerberos-iaa-providers-bundle/nifi-kerberos-iaa-providers/src/main/java/org/apache/nifi/kerberos/KerberosProvider.java +++ b/nifi-extension-bundles/nifi-kerberos-iaa-providers-bundle/nifi-kerberos-iaa-providers/src/main/java/org/apache/nifi/kerberos/KerberosProvider.java @@ -116,8 +116,8 @@ public class KerberosProvider implements LoginIdentityProvider { final Authentication authentication = provider.authenticate(token); if (logger.isDebugEnabled()) { - logger.debug("Ran provider.authenticate() and returned authentication for " + - "principal {} with name {} and is authenticated {}", authentication.getPrincipal(), authentication.getName(), authentication.isAuthenticated()); + logger.debug("Ran provider.authenticate() and returned authentication for principal {} with name {} and is authenticated {}", + authentication.getPrincipal(), authentication.getName(), authentication.isAuthenticated()); } return new AuthenticationResponse(authentication.getName(), identity, expiration, issuer); diff --git a/nifi-extension-bundles/nifi-kudu-bundle/nifi-kudu-controller-service/src/main/java/org/apache/nifi/controller/kudu/KuduLookupService.java b/nifi-extension-bundles/nifi-kudu-bundle/nifi-kudu-controller-service/src/main/java/org/apache/nifi/controller/kudu/KuduLookupService.java index 6d995647f4..8595514eea 100644 --- a/nifi-extension-bundles/nifi-kudu-bundle/nifi-kudu-controller-service/src/main/java/org/apache/nifi/controller/kudu/KuduLookupService.java +++ b/nifi-extension-bundles/nifi-kudu-bundle/nifi-kudu-controller-service/src/main/java/org/apache/nifi/controller/kudu/KuduLookupService.java @@ -199,7 +199,7 @@ public class KuduLookupService extends AbstractControllerService implements Reco getLogger().debug("Kudu connection successfully initialized"); } } catch (final Exception ex) { - getLogger().error("Exception occurred while interacting with Kudu due to " + ex.getMessage(), ex); + getLogger().error("Exception occurred while interacting with Kudu", ex); throw new InitializationException(ex); } diff --git a/nifi-extension-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java b/nifi-extension-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java index 002a378ac9..4730203769 100644 --- a/nifi-extension-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java +++ b/nifi-extension-bundles/nifi-ldap-iaa-providers-bundle/nifi-ldap-iaa-providers/src/main/java/org/apache/nifi/ldap/tenants/LdapUserGroupProvider.java @@ -680,10 +680,10 @@ public class LdapUserGroupProvider implements UserGroupProvider { if (logger.isDebugEnabled()) { logger.debug("-------------------------------------"); logger.debug("Loaded the following users from LDAP:"); - userList.forEach((user) -> logger.debug(" - " + user)); + userList.forEach((user) -> logger.debug(" - {}", user)); logger.debug("--------------------------------------"); logger.debug("Loaded the following groups from LDAP:"); - groupList.forEach((group) -> logger.debug(" - " + group)); + groupList.forEach((group) -> logger.debug(" - {}", group)); logger.debug("--------------------------------------"); } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/RepositoryConfiguration.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/RepositoryConfiguration.java index 54d879bab5..04d2ff22b5 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/RepositoryConfiguration.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/RepositoryConfiguration.java @@ -416,7 +416,7 @@ public class RepositoryConfiguration { // which must be kept intact if (maxAttrChars < 36) { maxAttrChars = 36; - logger.warn("Found max attribute length property set to " + maxAttrLength + " but minimum length is 36; using 36 instead"); + logger.warn("Found max attribute length property set to {} but minimum length is 36; using 36 instead", maxAttrLength); } } catch (final Exception e) { maxAttrChars = defaultMaxAttrChars; diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java index 3d68332843..74bb5e1710 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/IndexDirectoryManager.java @@ -439,8 +439,8 @@ public class IndexDirectoryManager { // We didn't find the old index directory. Just add the new index directory. final long timestamp = DirectoryUtils.getIndexTimestamp(indexDirectory); if (timestamp < 0) { - logger.debug("Attempted to replace old index directory {} with new index directory but the old index directory did not " + - "exist and could not determine timestamp for new index directory", indexDirectory); + logger.debug("Attempted to replace old index directory {} with new index directory but the old index directory did not exist and could not determine timestamp for new index directory", + indexDirectory); } else { final String partitionName = getPartitionName(indexDirectory); if (partitionName == null) { diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneCacheWarmer.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneCacheWarmer.java index 801bc6bc1a..784543ee84 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneCacheWarmer.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/LuceneCacheWarmer.java @@ -43,11 +43,11 @@ public class LuceneCacheWarmer implements Runnable { try { final File[] indexDirs = storageDir.listFiles(DirectoryUtils.INDEX_FILE_FILTER); if (indexDirs == null) { - logger.info("Cannot warm Lucene Index Cache for " + storageDir + " because the directory could not be read"); + logger.info("Cannot warm Lucene Index Cache for {} because the directory could not be read", storageDir); return; } - logger.info("Beginning warming of Lucene Index Cache for " + storageDir); + logger.info("Beginning warming of Lucene Index Cache for {}", storageDir); final long startNanos = System.nanoTime(); for (final File indexDir : indexDirs) { final long indexStartNanos = System.nanoTime(); @@ -69,7 +69,7 @@ public class LuceneCacheWarmer implements Runnable { final long warmSecs = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startNanos); logger.info("Finished warming all Lucene Indexes for {} in {} seconds", storageDir, warmSecs); } catch (final Exception e) { - logger.error("Failed to warm Lucene Index Cache for " + storageDir, e); + logger.error("Failed to warm Lucene Index Cache for {}", storageDir, e); } } } 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 60f444f988..41bbcffc77 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 @@ -495,7 +495,7 @@ public class LuceneEventIndex implements EventIndex { try { eventOption = eventStore.getEvent(eventId); } catch (final Exception e) { - logger.error("Failed to retrieve Provenance Event with ID " + eventId + " to calculate data lineage due to: " + e, e); + logger.error("Failed to retrieve Provenance Event with ID {} to calculate data lineage", eventId, e); final AsyncLineageSubmission result = new AsyncLineageSubmission(LineageComputationType.FLOWFILE_LINEAGE, eventId, Collections.emptySet(), 1, user == null ? null : user.getIdentity()); result.getResult().setError("Failed to retrieve Provenance Event with ID " + eventId + ". See logs for more information."); return result; @@ -862,8 +862,8 @@ public class LuceneEventIndex implements EventIndex { FileUtils.deleteFile(indexDirectory, true); logger.debug("Successfully deleted directory {}", indexDirectory); } catch (final IOException e) { - logger.warn("The Lucene Index located at " + indexDirectory + " has expired and contains no Provenance Events that still exist in the respository. " - + "However, the directory could not be deleted.", e); + logger.warn("The Lucene Index located at {} has expired and contains no Provenance Events that still exist in the repository. However, the directory could not be deleted.", + indexDirectory, e); } directoryManager.removeDirectory(indexDirectory); diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java index a6ef58a22b..ea905252d5 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/index/lucene/QueryTask.java @@ -102,7 +102,7 @@ public class QueryTask implements Runnable { return; } catch (final IOException ioe) { queryResult.setError("Failed to query index " + indexDir + "; see logs for more details"); - logger.error("Failed to query index " + indexDir, ioe); + logger.error("Failed to query index {}", indexDir, ioe); return; } @@ -135,7 +135,7 @@ public class QueryTask implements Runnable { topDocs = searcher.getIndexSearcher().search(query, maxResults, sort); } catch (final Exception e) { - logger.error("Failed to query Lucene for index " + indexDir, e); + logger.error("Failed to query Lucene for index {}", indexDir, e); queryResult.setError("Failed to query Lucene for index " + indexDir + " due to " + e); return; } finally { @@ -170,7 +170,7 @@ public class QueryTask implements Runnable { indexDir, query, eventsAndTotalHits.getKey().size(), eventsAndTotalHits.getValue(), millis); } } catch (final Exception e) { - logger.error("Failed to query events against index " + indexDir, e); + logger.error("Failed to query events against index {}", indexDir, e); queryResult.setError("Failed to complete query due to " + e); } finally { indexManager.returnIndexSearcher(searcher); diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DocsReader.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DocsReader.java index e62900d324..4b228b4ccc 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DocsReader.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/lucene/DocsReader.java @@ -102,7 +102,7 @@ public class DocsReader { } if (record == null) { - logger.warn("Failed to read Provenance Event for '" + d + "'. The event file may be missing or corrupted"); + logger.warn("Failed to read Provenance Event for '{}'. The event file may be missing or corrupted", d); } return record; diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/CompressableRecordReader.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/CompressableRecordReader.java index dfbcd2b6ad..9c77db4b7d 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/CompressableRecordReader.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/serialization/CompressableRecordReader.java @@ -293,7 +293,7 @@ public abstract class CompressableRecordReader implements RecordReader { // cause that would need to be sorted out in this case, the Provenance Repository should be // resilient enough to handle this. Otherwise, we end up throwing an Exception, which may // prevent iterating over additional events in the repository. - logger.error("Failed to read Provenance Event from " + filename + "; will skip this event and continue reading subsequent events", e); + logger.error("Failed to read Provenance Event from {}; will skip this event and continue reading subsequent events", filename, e); } } } else { diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java index 25fb559dc5..e4e0950ff8 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/PartitionedEventStore.java @@ -248,7 +248,7 @@ public abstract class PartitionedEventStore implements EventStore { try { partition.purgeOldEvents(maxFileLife, TimeUnit.MILLISECONDS); } catch (final Exception e) { - logger.error("Failed to purge expired events from " + partition, e); + logger.error("Failed to purge expired events from {}", partition, e); eventReporter.reportEvent(Severity.WARNING, EVENT_CATEGORY, "Failed to purge expired events from Provenance Repository. See logs for more information."); } @@ -271,7 +271,7 @@ public abstract class PartitionedEventStore implements EventStore { final long removed = partition.purgeOldestEvents(); currentSize -= removed; } catch (final Exception e) { - logger.error("Failed to purge oldest events from " + partition, e); + logger.error("Failed to purge oldest events from {}", partition, e); eventReporter.reportEvent(Severity.WARNING, EVENT_CATEGORY, "Failed to purge oldest events from Provenance Repository. See logs for more information."); } diff --git a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/RecordWriterLease.java b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/RecordWriterLease.java index a3ed241634..eab4383f3a 100644 --- a/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/RecordWriterLease.java +++ b/nifi-extension-bundles/nifi-provenance-repository-bundle/nifi-persistent-provenance-repository/src/main/java/org/apache/nifi/provenance/store/RecordWriterLease.java @@ -74,7 +74,7 @@ public class RecordWriterLease { try { writer.close(); } catch (final Exception e) { - logger.warn("Failed to close " + writer, e); + logger.warn("Failed to close {}", writer, e); } } } @@ -121,7 +121,7 @@ public class RecordWriterLease { try { writer.close(); } catch (final Exception e) { - logger.warn("Failed to close " + writer, e); + logger.warn("Failed to close {}", 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 e702b24f66..1e91a2812c 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 @@ -684,7 +684,7 @@ public class WriteAheadStorePartition implements EventStorePartition { try { eventIndex.commitChanges(partitionName); } catch (final IOException e) { - logger.error("Failed to re-index Provenance Events for partition " + partitionName, e); + logger.error("Failed to re-index Provenance Events for partition {}", partitionName, e); } executor.shutdown(); diff --git a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java index dba6f57c81..999729855c 100644 --- a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java +++ b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/service/SimpleRedisDistributedMapCacheClientService.java @@ -245,7 +245,7 @@ public class SimpleRedisDistributedMapCacheClientService extends AbstractControl try { redisConnection.close(); } catch (Exception e) { - getLogger().warn("Error closing connection: " + e.getMessage(), e); + getLogger().warn("Error closing connection", e); } } } diff --git a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/state/RedisStateProvider.java b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/state/RedisStateProvider.java index 4792523eef..d1005db43d 100644 --- a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/state/RedisStateProvider.java +++ b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-extensions/src/main/java/org/apache/nifi/redis/state/RedisStateProvider.java @@ -360,7 +360,7 @@ public class RedisStateProvider extends AbstractConfigurableComponent implements try { redisConnection.close(); } catch (Exception e) { - logger.warn("Error closing connection: " + e.getMessage(), e); + logger.warn("Error closing connection", e); } } } diff --git a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java index 54c8417b6d..68d54c9619 100644 --- a/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java +++ b/nifi-extension-bundles/nifi-redis-bundle/nifi-redis-utils/src/main/java/org/apache/nifi/redis/util/RedisUtils.java @@ -388,7 +388,7 @@ public class RedisUtils { JedisConnectionFactory connectionFactory; if (RedisType.STANDALONE == redisMode) { - LOGGER.info("Connecting to Redis in standalone mode at " + connectionString); + LOGGER.info("Connecting to Redis in standalone mode at {}", connectionString); final String[] hostAndPortSplit = connectionString.split("[:]"); final String host = hostAndPortSplit[0].trim(); final Integer port = Integer.parseInt(hostAndPortSplit[1].trim()); @@ -404,10 +404,10 @@ public class RedisUtils { enrichRedisConfiguration(sentinelConfiguration, dbIndex, username, password, sentinelUsername, sentinelPassword); LOGGER.info("Connecting to Redis in sentinel mode..."); - LOGGER.info("Redis master = " + sentinelMaster); + LOGGER.info("Redis master = {}", sentinelMaster); for (final String sentinel : sentinels) { - LOGGER.info("Redis sentinel at " + sentinel); + LOGGER.info("Redis sentinel at {}", sentinel); } connectionFactory = new JedisConnectionFactory(sentinelConfiguration, jedisClientConfiguration); @@ -422,7 +422,7 @@ public class RedisUtils { LOGGER.info("Connecting to Redis in clustered mode..."); for (final String clusterNode : clusterNodes) { - LOGGER.info("Redis cluster node at " + clusterNode); + LOGGER.info("Redis cluster node at {}", clusterNode); } connectionFactory = new JedisConnectionFactory(clusterConfiguration, jedisClientConfiguration); diff --git a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/lookup/script/BaseScriptedLookupService.java b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/lookup/script/BaseScriptedLookupService.java index aee8b79a95..4a1f4b2bb6 100644 --- a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/lookup/script/BaseScriptedLookupService.java +++ b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/lookup/script/BaseScriptedLookupService.java @@ -429,7 +429,7 @@ public class BaseScriptedLookupService extends AbstractScriptedControllerService } }); } catch (final Exception e) { - logger.error("Unable to initialize scripted LookupService: " + e.getLocalizedMessage(), e); + logger.error("Unable to initialize scripted LookupService", e); throw new ProcessException(e); } } diff --git a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java index 2853bccb3f..e0b74d156b 100644 --- a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java +++ b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/InvokeScriptedProcessor.java @@ -435,7 +435,7 @@ public class InvokeScriptedProcessor extends AbstractSessionFactoryProcessor { } }); } catch (final Exception e) { - logger.error("Unable to initialize scripted Processor: " + e.getLocalizedMessage(), e); + logger.error("Unable to initialize scripted Processor", e); throw new ProcessException(e); } } @@ -628,11 +628,11 @@ public class InvokeScriptedProcessor extends AbstractSessionFactoryProcessor { invocable.invokeMethod(obj, methodName, params); } catch (final NoSuchMethodException nsme) { if (logger.isDebugEnabled()) { - logger.debug("Configured script Processor does not contain the method " + methodName); + logger.debug("Configured script Processor does not contain the method {}", methodName); } } catch (final Exception e) { // An error occurred during onScheduled, propagate it up - logger.error("Error while executing the scripted processor's method " + methodName, e); + logger.error("Error while executing the scripted processor's method {}", methodName, e); if (e instanceof ProcessException) { throw (ProcessException) e; } diff --git a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedPartitionRecord.java b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedPartitionRecord.java index ba64a1261e..e93db9ea85 100644 --- a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedPartitionRecord.java +++ b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedPartitionRecord.java @@ -235,7 +235,7 @@ public class ScriptedPartitionRecord extends ScriptedRecordProcessor { return true; } catch (final Exception e) { - getLogger().error("Failed to partition records due to: " + e.getMessage(), e); + getLogger().error("Failed to partition records", e); return false; } } diff --git a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedRouterProcessor.java b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedRouterProcessor.java index 50aeaa90f4..4a17dc439a 100644 --- a/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedRouterProcessor.java +++ b/nifi-extension-bundles/nifi-scripting-bundle/nifi-scripting-processors/src/main/java/org/apache/nifi/processors/script/ScriptedRouterProcessor.java @@ -197,7 +197,7 @@ public abstract class ScriptedRouterProcessor extends ScriptedRecordProcessor session.adjustCounter("Records Processed", counts.getRecordCount(), true); return true; } catch (final Exception e) { - getLogger().error("Failed to route records due to: " + e.getMessage(), e); + getLogger().error("Failed to route records", e); return false; } } diff --git a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java index cc74e80d07..2b2b539aa6 100644 --- a/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java +++ b/nifi-extension-bundles/nifi-site-to-site-reporting-bundle/nifi-site-to-site-reporting-task/src/main/java/org/apache/nifi/reporting/SiteToSiteProvenanceReportingTask.java @@ -205,7 +205,7 @@ public class SiteToSiteProvenanceReportingTask extends AbstractSiteToSiteReporti try { consumer.addTargetEventType(ProvenanceEventType.valueOf(type)); } catch (Exception e) { - getLogger().warn(type + " is not a correct event type, removed from the filtering."); + getLogger().warn("{} is not a correct event type, removed from the filtering.", type); } } } @@ -216,7 +216,7 @@ public class SiteToSiteProvenanceReportingTask extends AbstractSiteToSiteReporti try { consumer.addTargetEventTypeExclude(ProvenanceEventType.valueOf(type)); } catch (Exception e) { - getLogger().warn(type + " is not a correct event type, removed from the exclude filtering."); + getLogger().warn("{} is not a correct event type, removed from the exclude filtering.", type); } } } diff --git a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java index cdf9175193..93583f8125 100644 --- a/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java +++ b/nifi-extension-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/main/java/org/apache/nifi/snmp/processors/AbstractSNMPProcessor.java @@ -150,7 +150,7 @@ public abstract class AbstractSNMPProcessor extends AbstractProcessor { final SNMPResponseStatus snmpResponseStatus = processResponse(response); processSession.putAllAttributes(flowFile, response.getAttributes()); if (snmpResponseStatus.getErrorStatus() == ErrorStatus.FAILURE) { - getLogger().error("SNMP request failed, response error: " + snmpResponseStatus.getErrorMessage()); + getLogger().error("SNMP request failed, response error: {}", snmpResponseStatus.getErrorMessage()); processSession.transfer(flowFile, failure); context.yield(); } else { diff --git a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/GetSnowflakeIngestStatus.java b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/GetSnowflakeIngestStatus.java index 76997da03e..b4d4a2dacd 100644 --- a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/GetSnowflakeIngestStatus.java +++ b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/GetSnowflakeIngestStatus.java @@ -102,7 +102,7 @@ public class GetSnowflakeIngestStatus extends AbstractProcessor { final String stagedFilePath = flowFile.getAttribute(ATTRIBUTE_STAGED_FILE_PATH); if (stagedFilePath == null) { - getLogger().error("Missing required attribute [\"" + ATTRIBUTE_STAGED_FILE_PATH + "\"] for FlowFile"); + getLogger().error("Missing required attribute [\"{}\"] for FlowFile", ATTRIBUTE_STAGED_FILE_PATH); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } @@ -117,7 +117,7 @@ public class GetSnowflakeIngestStatus extends AbstractProcessor { } catch (URISyntaxException | IOException e) { throw new ProcessException("Failed to get Snowflake ingest history for staged file [" + stagedFilePath + "]", e); } catch (IngestResponseException e) { - getLogger().error("Failed to get Snowflake ingest history for staged file [" + stagedFilePath + "]", e); + getLogger().error("Failed to get Snowflake ingest history for staged file [{}]", stagedFilePath, e); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } @@ -133,8 +133,7 @@ public class GetSnowflakeIngestStatus extends AbstractProcessor { } if (fileEntry.get().getErrorsSeen() > 0) { - getLogger().error("Failed to ingest file [" + stagedFilePath + "] in Snowflake stage via pipe [" + ingestManagerProviderService.getPipeName() + "]." - + " Error: " + fileEntry.get().getFirstError()); + getLogger().error("Failed to ingest file [{}] in Snowflake stage via pipe [{}]. Error: {}", stagedFilePath, ingestManagerProviderService.getPipeName(), fileEntry.get().getFirstError()); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } diff --git a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/PutSnowflakeInternalStage.java b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/PutSnowflakeInternalStage.java index 7ed7d5cdf9..c0d3bf63cc 100644 --- a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/PutSnowflakeInternalStage.java +++ b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/PutSnowflakeInternalStage.java @@ -154,7 +154,7 @@ public class PutSnowflakeInternalStage extends AbstractProcessor { snowflakeConnection.unwrap() .uploadStream(internalStageName, "", inputStream, stagedFileName, false); } catch (SQLException e) { - getLogger().error("Failed to upload FlowFile content to internal Snowflake stage [" + internalStageName + "]. Staged file path [" + stagedFileName + "]", e); + getLogger().error("Failed to upload FlowFile content to internal Snowflake stage [{}]. Staged file path [{}]", internalStageName, stagedFileName, e); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } catch (IOException e) { diff --git a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/StartSnowflakeIngest.java b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/StartSnowflakeIngest.java index 4fbede80db..e3cbbbfe92 100644 --- a/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/StartSnowflakeIngest.java +++ b/nifi-extension-bundles/nifi-snowflake-bundle/nifi-snowflake-processors/src/main/java/org/apache/nifi/processors/snowflake/StartSnowflakeIngest.java @@ -95,7 +95,7 @@ public class StartSnowflakeIngest extends AbstractProcessor { final String stagedFilePath = flowFile.getAttribute(ATTRIBUTE_STAGED_FILE_PATH); if (stagedFilePath == null) { - getLogger().error("Missing required attribute [\"" + ATTRIBUTE_STAGED_FILE_PATH + "\"] for FlowFile"); + getLogger().error("Missing required attribute [\"{}\"] for FlowFile", ATTRIBUTE_STAGED_FILE_PATH); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } @@ -110,7 +110,7 @@ public class StartSnowflakeIngest extends AbstractProcessor { } catch (URISyntaxException | IOException e) { throw new ProcessException(String.format("Failed to ingest Snowflake file [%s]", stagedFilePath), e); } catch (IngestResponseException e) { - getLogger().error("Failed to ingest Snowflake file [" + stagedFilePath + "]", e); + getLogger().error("Failed to ingest Snowflake file [{}]", stagedFilePath, e); session.transfer(session.penalize(flowFile), REL_FAILURE); return; } diff --git a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java index 8075f466fa..7986c6b5ff 100644 --- a/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java +++ b/nifi-extension-bundles/nifi-splunk-bundle/nifi-splunk-processors/src/main/java/org/apache/nifi/processors/splunk/GetSplunk.java @@ -494,7 +494,7 @@ public class GetSplunk extends AbstractProcessor implements ClassloaderIsolation export = splunkService.export(query, exportArgs); //Catch Stale connection exception, reinitialize, and retry } catch (com.splunk.HttpException e) { - getLogger().error("Splunk request status code:" + e.getStatus() + " Retrying the request."); + getLogger().error("Splunk request status code:{} Retrying the request.", e.getStatus()); splunkService.logout(); splunkService = createSplunkService(context); export = splunkService.export(query, exportArgs); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java index 0bb924350a..bd66a99f10 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-parameter-providers/src/main/java/org/apache/nifi/parameter/DatabaseParameterProvider.java @@ -191,7 +191,7 @@ public class DatabaseParameterProvider extends AbstractParameterProvider impleme } final String query = getQuery(context, tableName, columns, whereClause); - getLogger().info("Fetching parameters with query: " + query); + getLogger().info("Fetching parameters with query: {}", query); try (final ResultSet rs = st.executeQuery(query)) { while (rs.next()) { final String parameterName = rs.getString(parameterNameColumn); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CountText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CountText.java index 5621816663..2ff3458641 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CountText.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CountText.java @@ -257,7 +257,7 @@ public class CountText extends AbstractProcessor { if (getLogger().isDebugEnabled()) { final long durationNanos = stop - start; DecimalFormat df = new DecimalFormat("#.###"); - getLogger().debug("Computed metrics in " + durationNanos + " nanoseconds (" + df.format(durationNanos / 1_000_000_000.0) + " seconds)."); + getLogger().debug("Computed metrics in {} nanoseconds ({} seconds).", durationNanos, df.format(durationNanos / 1_000_000_000.0)); } if (getLogger().isInfoEnabled()) { String message = generateMetricsMessage(lineCount.get(), lineNonEmptyCount.get(), wordCount.get(), characterCount.get()); @@ -271,7 +271,7 @@ public class CountText extends AbstractProcessor { processSession.adjustCounter("Characters Counted", (long) characterCount.get(), adjustImmediately); } catch (IOException e) { error.set(true); - getLogger().error(e.getMessage() + " Routing to failure.", e); + getLogger().error("Routing to failure.", e); } }); @@ -323,7 +323,7 @@ public class CountText extends AbstractProcessor { final Stream wordsStream = regex.splitAsStream(line).filter(item -> !item.trim().isEmpty()); if (getLogger().isDebugEnabled()) { final List words = wordsStream.collect(Collectors.toList()); - getLogger().debug("Split [" + line + "] to [" + StringUtils.join(words, ", ") + "] (" + words.size() + ")"); + getLogger().debug("Split [{}] to [{}] ({})", line, StringUtils.join(words, ", "), words.size()); return Math.toIntExact(words.size()); } else { return Math.toIntExact(wordsStream.count()); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeduplicateRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeduplicateRecord.java index 9dd615079d..5bfc5066ae 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeduplicateRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/DeduplicateRecord.java @@ -500,7 +500,7 @@ public class DeduplicateRecord extends AbstractProcessor { duplicatesWriteResult = duplicatesWriter.finishRecordSet(); } catch (final Exception e) { - logger.error("Failed in detecting duplicate records at index " + index, e); + logger.error("Failed in detecting duplicate records at index {}", index, e); error = true; } finally { if (!error) { diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EnforceOrder.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EnforceOrder.java index 0864c16e07..588ca0f7c6 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EnforceOrder.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/EnforceOrder.java @@ -269,7 +269,7 @@ public class EnforceOrder extends AbstractProcessor { try { stateMap = session.getState(Scope.LOCAL); } catch (final IOException e) { - getLogger().error("Failed to retrieve state from StateManager due to {}" + e, e); + getLogger().error("Failed to retrieve state from StateManager", e); context.yield(); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java index 0ae8dae21a..5d0a2ce49e 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java @@ -476,10 +476,10 @@ public class ExecuteStreamCommand extends AbstractProcessor { } catch (IOException e) { try { if (!errorOut.delete()) { - logger.warn("Unable to delete file: " + errorOut.getAbsolutePath()); + logger.warn("Unable to delete file: {}", errorOut.getAbsolutePath()); } } catch (SecurityException se) { - logger.warn("Unable to delete file: '" + errorOut.getAbsolutePath() + "' due to " + se); + logger.warn("Unable to delete file: '{}'", errorOut.getAbsolutePath(), se); } logger.error("Could not create external process to run command", e); throw new ProcessException(e); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ForkRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ForkRecord.java index ff0da33ca7..6d5bea67c4 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ForkRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ForkRecord.java @@ -292,8 +292,8 @@ public class ForkRecord extends AbstractProcessor { // we want to have records in the array if (elementType.getFieldType() != RecordFieldType.RECORD) { - getLogger().debug("The record path {} is matching an array field with values of type {} " + - "when the type RECORD is expected.", recordPath.getPath(), elementType.getFieldType()); + getLogger().debug("The record path {} is matching an array field with values of type {} when the type RECORD is expected.", + recordPath.getPath(), elementType.getFieldType()); continue; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java index 1cc43e3b05..ff5e4400d3 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/HandleHttpResponse.java @@ -134,8 +134,7 @@ public class HandleHttpResponse extends AbstractProcessor { final String contextIdentifier = flowFile.getAttribute(HTTPUtils.HTTP_CONTEXT_ID); if (contextIdentifier == null) { - getLogger().warn("Failed to respond to HTTP request for {} because FlowFile did not have an '" + HTTPUtils.HTTP_CONTEXT_ID + "' attribute", - new Object[]{flowFile}); + getLogger().warn("Failed to respond to HTTP request for {} because FlowFile did not have an '{}' attribute", flowFile, HTTPUtils.HTTP_CONTEXT_ID); 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/ListenHTTP.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java index b275e11b62..6d874b669f 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java @@ -564,7 +564,7 @@ public class ListenHTTP extends AbstractSessionFactoryProcessor { createHttpServerFromService(context); } } catch (Exception e) { - getLogger().warn("Failed to start http server during initialization: " + e); + getLogger().warn("Failed to start http server during initialization", e); context.yield(); throw new ProcessException("Failed to initialize the server", e); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenTCPRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenTCPRecord.java index c2198246f9..7958590c90 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenTCPRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenTCPRecord.java @@ -330,7 +330,7 @@ public class ListenTCPRecord extends AbstractProcessor { try { socketRecordReader.close(); } catch (Exception e) { - getLogger().error("Couldn't close " + socketRecordReader, e); + getLogger().error("Couldn't close {}", socketRecordReader, e); } } } @@ -460,7 +460,7 @@ public class ListenTCPRecord extends AbstractProcessor { socketReaders.offer(socketRecordReader); } catch (Exception e) { - getLogger().error("Error processing records: " + e.getMessage(), e); + getLogger().error("Error processing records", e); IOUtils.closeQuietly(socketRecordReader); session.remove(flowFile); return; diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java index 3c72578471..9f65bbbc70 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenUDPRecord.java @@ -311,7 +311,7 @@ public class ListenUDPRecord extends AbstractListenEventProcessor writer.write(record); } } catch (Exception e) { - getLogger().error("Failed to write records due to: " + e.getMessage(), e); + getLogger().error("Failed to write records", e); IOUtils.closeQuietly(writer); session.remove(flowFileRecordWriter.getFlowFile()); flowFileRecordWriters.remove(event.getSender()); @@ -354,7 +354,7 @@ public class ListenUDPRecord extends AbstractListenEventProcessor session.getProvenanceReporter().receive(flowFile, transitUri); } catch (final Exception e) { - getLogger().error("Unable to properly complete record set due to: " + e.getMessage(), e); + getLogger().error("Unable to properly complete record set", e); session.remove(flowFile); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MonitorActivity.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MonitorActivity.java index 00301e1b5e..3d7ebfef4c 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MonitorActivity.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/MonitorActivity.java @@ -258,7 +258,7 @@ public class MonitorActivity extends AbstractProcessor { try { stateManager.clear(Scope.CLUSTER); } catch (IOException e) { - getLogger().error("Failed to clear cluster state" + e, e); + getLogger().error("Failed to clear cluster state", e); } } } @@ -396,7 +396,7 @@ public class MonitorActivity extends AbstractProcessor { String.valueOf(localFlowActivityInfo.getLastActivity()) ), Scope.LOCAL); } catch (IOException e) { - getLogger().error("Failed to set local state due to " + e, e); + getLogger().error("Failed to set local state", e); } } @@ -414,8 +414,7 @@ public class MonitorActivity extends AbstractProcessor { return true; } if (logInvalidConfig) { - getLogger().warn("NiFi is running as a Standalone mode, but 'cluster' scope is set." + - " Fallback to 'node' scope. Fix configuration to stop this message."); + getLogger().warn("NiFi is running as a Standalone mode, but 'cluster' scope is set. Fallback to 'node' scope. Fix configuration to stop this message."); } } return false; diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java index 26858a4360..e0dbf5b38b 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/PutDatabaseRecord.java @@ -1234,8 +1234,8 @@ public class PutDatabaseRecord extends AbstractProcessor { includedColumns.add(i); } else { // User is ignoring unmapped fields, but log at debug level just in case - getLogger().debug("Did not map field '" + fieldName + "' to any column in the database\n" - + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); + getLogger().debug("Did not map field '{}' to any column in the database\n{}Columns: {}", + fieldName, (settings.translateFieldNames ? "Normalized " : ""), String.join(",", tableSchema.getColumns().keySet())); } } @@ -1287,8 +1287,8 @@ public class PutDatabaseRecord extends AbstractProcessor { usedColumnIndices.add(i); } else { // User is ignoring unmapped fields, but log at debug level just in case - getLogger().debug("Did not map field '" + fieldName + "' to any column in the database\n" - + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); + getLogger().debug("Did not map field '{}' to any column in the database\n{}Columns: {}", + fieldName, (settings.translateFieldNames ? "Normalized " : ""), String.join(",", tableSchema.getColumns().keySet())); } } } @@ -1341,8 +1341,8 @@ public class PutDatabaseRecord extends AbstractProcessor { usedColumnIndices.add(i); } else { // User is ignoring unmapped fields, but log at debug level just in case - getLogger().debug("Did not map field '" + fieldName + "' to any column in the database\n" - + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); + getLogger().debug("Did not map field '{}' to any column in the database\n{}Columns: {}", + fieldName, (settings.translateFieldNames ? "Normalized " : ""), String.join(",", tableSchema.getColumns().keySet())); } } } @@ -1393,8 +1393,8 @@ public class PutDatabaseRecord extends AbstractProcessor { + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); } else { // User is ignoring unmapped fields, but log at debug level just in case - getLogger().debug("Did not map field '" + fieldName + "' to any column in the database\n" - + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); + getLogger().debug("Did not map field '{}' to any column in the database\nColumns: {}", + fieldName, (settings.translateFieldNames ? "Normalized " : ""), String.join(",", tableSchema.getColumns().keySet())); continue; } } @@ -1525,8 +1525,8 @@ public class PutDatabaseRecord extends AbstractProcessor { includedColumns.add(i); } else { // User is ignoring unmapped fields, but log at debug level just in case - getLogger().debug("Did not map field '" + fieldName + "' to any column in the database\n" - + (settings.translateFieldNames ? "Normalized " : "") + "Columns: " + String.join(",", tableSchema.getColumns().keySet())); + getLogger().debug("Did not map field '{}' to any column in the database\n{}Columns: {}", + fieldName, (settings.translateFieldNames ? "Normalized " : ""), String.join(",", tableSchema.getColumns().keySet())); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitText.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitText.java index 1251d9542d..f319b6d759 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitText.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/SplitText.java @@ -223,8 +223,8 @@ public class SplitText extends AbstractProcessor { splitInfo = SplitText.this.computeHeader(demarcator, startOffset, SplitText.this.headerLineCount, null, null); if ((splitInfo != null) && (splitInfo.lineCount < SplitText.this.headerLineCount)) { error.set(true); - getLogger().error("Unable to split " + sourceFlowFile + " due to insufficient amount of header lines. Required " - + SplitText.this.headerLineCount + " but was " + splitInfo.lineCount + ". Routing to failure."); + getLogger().error("Unable to split {} due to insufficient amount of header lines. Required {} but was {}. Routing to failure.", + sourceFlowFile, SplitText.this.headerLineCount, splitInfo.lineCount); } } else if (SplitText.this.headerMarker != null) { splitInfo = SplitText.this.computeHeader(demarcator, startOffset, Long.MAX_VALUE, SplitText.this.headerMarker.getBytes(StandardCharsets.UTF_8), null); @@ -232,7 +232,7 @@ public class SplitText extends AbstractProcessor { headerSplitInfoRef.set(splitInfo); } catch (IllegalStateException e) { error.set(true); - getLogger().error(e.getMessage() + " Routing to failure.", e); + getLogger().error("Routing to failure.", e); } // Compute and collect fragments representing the individual splits @@ -247,7 +247,7 @@ public class SplitText extends AbstractProcessor { } long stop = System.nanoTime(); if (getLogger().isDebugEnabled()) { - getLogger().debug("Computed splits in " + (stop - start) + " milliseconds."); + getLogger().debug("Computed splits in {} milliseconds.", (stop - start)); } } } 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 896b2958e1..3317356fea 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 @@ -712,7 +712,7 @@ public class TailFile extends AbstractProcessor { try { processTailFile(context, session, tailFile); } catch (NulCharacterEncounteredException e) { - getLogger().warn("NUL character encountered in " + tailFile + " and '" + REREAD_ON_NUL.getDisplayName() + "' is set to 'true', yielding."); + getLogger().warn("NUL character encountered in {} and '{}' is set to 'true', yielding.", tailFile, REREAD_ON_NUL.getDisplayName()); context.yield(); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java index ecca771fd4..7925327073 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateDatabaseTable.java @@ -483,7 +483,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { // Assume a column to be created is required if there is a default value in the schema final boolean required = (recordField.getDefaultValue() != null); columns.add(new ColumnDescription(recordFieldName, DataTypeUtils.getSQLTypeValue(recordField.getDataType()), required, null, recordField.isNullable())); - getLogger().debug("Adding column " + recordFieldName + " to table " + tableName); + getLogger().debug("Adding column {} to table {}", recordFieldName, tableName); } tableSchema = new TableSchema(catalogName, schemaName, tableName, columns, translateFieldNames, primaryKeyColumnNames, databaseAdapter.getColumnQuoteString()); @@ -492,7 +492,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { if (StringUtils.isNotEmpty(createTableSql)) { // Perform the table create - getLogger().info("Executing DDL: " + createTableSql); + getLogger().info("Executing DDL: {}", createTableSql); s.execute(createTableSql); } @@ -521,7 +521,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { recordField.getDefaultValue() != null, null, recordField.isNullable()); columnsToAdd.add(columnToAdd); dbColumns.add(recordFieldName); - getLogger().debug("Adding column " + recordFieldName + " to table " + tableName); + getLogger().debug("Adding column {} to table {}", recordFieldName, tableName); } } @@ -534,7 +534,7 @@ public class UpdateDatabaseTable extends AbstractProcessor { continue; } // Perform the table update - getLogger().info("Executing DDL: " + alterTableSql); + getLogger().info("Executing DDL: {}", alterTableSql); s.execute(alterTableSql); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBin.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBin.java index 4cad661491..c15f4968d3 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBin.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBin.java @@ -159,16 +159,16 @@ public class RecordBin { } if (isFull()) { - logger.debug(this + " is now full. Completing bin."); + logger.debug("{} is now full. Completing bin.", this); complete("Bin is full"); } else if (isOlderThan(thresholds.getMaxBinMillis(), TimeUnit.MILLISECONDS)) { - logger.debug(this + " is now expired. Completing bin."); + logger.debug("{} is now expired. Completing bin.", this); complete("Bin is older than " + thresholds.getMaxBinAge()); } return true; } catch (final Exception e) { - logger.error("Failed to create merged FlowFile from " + (flowFiles.size() + 1) + " input FlowFiles; routing originals to failure", e); + logger.error("Failed to create merged FlowFile from {} input FlowFiles; routing originals to failure", (flowFiles.size() + 1), e); try { // This will be closed by the MergeRecord class anyway but we have to close it diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBinManager.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBinManager.java index 32fe3dad90..08007e37f7 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBinManager.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/merge/RecordBinManager.java @@ -231,7 +231,7 @@ public class RecordBinManager { lock.unlock(); } - logger.debug("Completing Bin " + oldestBin + " because the maximum number of bins has been exceeded"); + logger.debug("Completing Bin {} because the maximum number of bins has been exceeded", oldestBin); oldestBin.complete("Maximum number of bins has been exceeded"); } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ContentAcknowledgmentServlet.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ContentAcknowledgmentServlet.java index 0a7056813e..b19fcd84cf 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ContentAcknowledgmentServlet.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ContentAcknowledgmentServlet.java @@ -94,8 +94,8 @@ public class ContentAcknowledgmentServlet extends HttpServlet { final String uuid = uri.substring(slashIndex + 1, questionIndex); final FlowFileEntryTimeWrapper timeWrapper = flowFileMap.remove(uuid); if (timeWrapper == null) { - logger.warn("received DELETE for HOLD with ID " + uuid + " from Remote Host: [" + request.getRemoteHost() - + "] Port [" + request.getRemotePort() + "] SubjectDN [" + foundSubject + "], but no HOLD exists with that ID; sending response with Status Code 404"); + logger.warn("received DELETE for HOLD with ID {} from Remote Host: [{}] Port [{}] SubjectDN [{}], but no HOLD exists with that ID; sending response with Status Code 404", + uuid, request.getRemoteHost(), request.getRemotePort(), foundSubject); response.sendError(HttpServletResponse.SC_NOT_FOUND); return; } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java index 4a4bc49e32..138645b060 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/servlets/ListenHTTPServlet.java @@ -203,7 +203,7 @@ public class ListenHTTPServlet extends HttpServlet { if (context.getAvailableRelationships().isEmpty()) { spaceAvailable.set(false); if (logger.isDebugEnabled()) { - logger.debug("Received request from " + request.getRemoteHost() + " but no space available; Indicating Service Unavailable"); + logger.debug("Received request from {} but no space available; Indicating Service Unavailable", request.getRemoteHost()); } response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE); return; @@ -261,7 +261,7 @@ public class ListenHTTPServlet extends HttpServlet { final InputStream in = (streamThrottler == null) ? unthrottled : streamThrottler.newThrottledInputStream(unthrottled); if (logger.isDebugEnabled()) { - logger.debug("Received request from " + request.getRemoteHost() + ", createHold=" + createHold + ", content-type=" + contentType + ", gzip=" + contentGzipped); + logger.debug("Received request from {}, createHold={}, content-type={}, gzip={}", request.getRemoteHost(), createHold, contentType, contentGzipped); } Set flowFileSet; 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 e9cb364df4..f1d03ff403 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 @@ -211,7 +211,7 @@ public class FTPTransfer implements FileTransfer { } if (depth >= 100) { - logger.warn(this + " had to stop recursively searching directories at a recursive depth of " + depth + " to avoid memory issues"); + logger.warn("{} had to stop recursively searching directories at a recursive depth of {} to avoid memory issues", this, depth); return listing; } @@ -275,7 +275,7 @@ public class FTPTransfer implements FileTransfer { try { listing.addAll(getListing(newFullForwardPath, depth + 1, maxResults - count, applyFilters)); } catch (final IOException e) { - logger.error("Unable to get listing from " + newFullForwardPath + "; skipping", e); + logger.error("Unable to get listing from {}; skipping", newFullForwardPath, e); } } @@ -539,7 +539,7 @@ public class FTPTransfer implements FileTransfer { if (!cmd.isEmpty()) { int result; result = client.sendCommand(cmd); - logger.debug(this + " sent command to the FTP server: " + cmd + " for " + flowFile); + logger.debug("{} sent command to the FTP server: {} for {}", this, cmd, flowFile); if (FTPReply.isNegativePermanent(result) || FTPReply.isNegativeTransient(result)) { throw new IOException(this + " negative reply back from FTP server cmd: " + cmd + " reply:" + result + ": " + client.getReplyString() + " for " + flowFile); 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 14d2380877..4efdfc5f08 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 @@ -297,7 +297,7 @@ public class SFTPTransfer implements FileTransfer { } if (depth >= 100) { - logger.warn(this + " had to stop recursively searching directories at a recursive depth of " + depth + " to avoid memory issues"); + logger.warn("{} had to stop recursively searching directories at a recursive depth of {} to avoid memory issues", this, depth); return; } @@ -389,7 +389,7 @@ public class SFTPTransfer implements FileTransfer { try { getListing(newFullForwardPath, depth + 1, maxResults, listing, applyFilters); } catch (final IOException e) { - logger.error("Unable to get listing from " + newFullForwardPath + "; skipping", e); + logger.error("Unable to get listing from {}; skipping", newFullForwardPath, e); } } @@ -561,7 +561,7 @@ public class SFTPTransfer implements FileTransfer { logger.debug(String.format("Could not create %s due to 'No such file'. Will try to create the parent dir.", remoteDirectory)); } else if (e.getStatusCode() == Response.StatusCode.FAILURE) { // Swallow '4: Failure' including the remote directory already exists. - logger.debug("Could not blindly create remote directory due to " + getMessage(e), e); + logger.debug("Could not blindly create remote directory", e); return; } else { throw new IOException("Could not blindly create remote directory due to " + e.getMessage(), e); diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQL.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQL.java index cc0f8038c1..5e5624b736 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQL.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteSQL.java @@ -618,7 +618,7 @@ public class TestExecuteSQL { recordsFromStream += 1; } - LOGGER.info("total nr of records from stream: " + recordsFromStream); + LOGGER.info("total nr of records from stream: {}", recordsFromStream); assertEquals(nrOfRows, recordsFromStream); } } diff --git a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTailFile.java b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTailFile.java index 12c9b698d4..e2b93116e8 100644 --- a/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTailFile.java +++ b/nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestTailFile.java @@ -876,7 +876,7 @@ public class TestTailFile { runner.clearTransferState(); for (int i = 0; i < 10; i++) { - logger.info("i = " + i); + logger.info("i = {}", i); raf.write(String.valueOf(i).getBytes()); raf.write("\n".getBytes()); diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java index b27a085c94..49a45f910b 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java @@ -82,7 +82,7 @@ public class CSVRecordLookupService extends AbstractCSVLookupService implements try { final ComponentLog logger = getLogger(); if (logger.isDebugEnabled()) { - logger.debug("Loading lookup table from file: " + csvFile); + logger.debug("Loading lookup table from file: {}", csvFile); } ConcurrentHashMap cache = new ConcurrentHashMap<>(); @@ -123,7 +123,7 @@ public class CSVRecordLookupService extends AbstractCSVLookupService implements this.cache = cache; if (cache.isEmpty()) { - logger.warn("Lookup table is empty after reading file: " + csvFile); + logger.warn("Lookup table is empty after reading file: {}", csvFile); } } finally { lock.unlock(); diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/DistributedMapCacheLookupService.java b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/DistributedMapCacheLookupService.java index 9d73dfdab9..6bd043187b 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/DistributedMapCacheLookupService.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/DistributedMapCacheLookupService.java @@ -112,7 +112,7 @@ public class DistributedMapCacheLookupService extends AbstractControllerService try { return Optional.ofNullable(cache.get(key, keySerializer, valueDeserializer)); } catch (IOException e) { - getLogger().error("Error while trying to get the value from distributed map cache with key = " + key, e); + getLogger().error("Error while trying to get the value from distributed map cache with key = {}", key, e); return Optional.empty(); } } diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/SimpleCsvFileLookupService.java b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/SimpleCsvFileLookupService.java index 874709679e..f0465135d0 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/SimpleCsvFileLookupService.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/SimpleCsvFileLookupService.java @@ -80,7 +80,7 @@ public class SimpleCsvFileLookupService extends AbstractCSVLookupService impleme try { final ComponentLog logger = getLogger(); if (logger.isDebugEnabled()) { - logger.debug("Loading lookup table from file: " + csvFile); + logger.debug("Loading lookup table from file: {}", csvFile); } final Map properties = new HashMap<>(); @@ -105,7 +105,7 @@ public class SimpleCsvFileLookupService extends AbstractCSVLookupService impleme this.cache = new ConcurrentHashMap<>(properties); if (cache.isEmpty()) { - logger.warn("Lookup table is empty after reading file: " + csvFile); + logger.warn("Lookup table is empty after reading file: {}", csvFile); } } finally { lock.unlock(); diff --git a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/configuration2/CommonsConfigurationLookupService.java b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/configuration2/CommonsConfigurationLookupService.java index 9ed3dad258..2ea7279b98 100644 --- a/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/configuration2/CommonsConfigurationLookupService.java +++ b/nifi-extension-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/configuration2/CommonsConfigurationLookupService.java @@ -109,7 +109,7 @@ public abstract class CommonsConfigurationLookupService maxBufferSize) { - logger.error("Dropping event " + eventHandle + " because it couldn't be rendered within " + maxBufferSize + " bytes."); + logger.error("Dropping event {} because it couldn't be rendered within {} bytes.", eventHandle, maxBufferSize); // Ignored, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa385577(v=vs.85).aspx return 0; } @@ -108,7 +107,7 @@ public class EventSubscribeXmlRenderingCallback implements WEvtApi.EVT_SUBSCRIBE } consumer.accept(string); } else { - logger.error(EVT_RENDER_RETURNED_THE_FOLLOWING_ERROR_CODE + errorLookup.getLastError() + "."); + logger.error( "{}{}.", EVT_RENDER_RETURNED_THE_FOLLOWING_ERROR_CODE, errorLookup.getLastError()); } } // Ignored, see https://msdn.microsoft.com/en-us/library/windows/desktop/aa385577(v=vs.85).aspx diff --git a/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/jna/EventSubscribeXmlRenderingCallbackTest.java b/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/jna/EventSubscribeXmlRenderingCallbackTest.java index 962d6b4f8e..34b789cc1a 100644 --- a/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/jna/EventSubscribeXmlRenderingCallbackTest.java +++ b/nifi-extension-bundles/nifi-windows-event-log-bundle/nifi-windows-event-log-processors/src/test/java/org/apache/nifi/processors/windows/event/log/jna/EventSubscribeXmlRenderingCallbackTest.java @@ -77,7 +77,7 @@ public class EventSubscribeXmlRenderingCallbackTest { when(pointer.getInt(0)).thenReturn(errorCode); eventSubscribeXmlRenderingCallback.onEvent(WEvtApi.EvtSubscribeNotifyAction.ERROR, null, handle); - verify(logger).error(EventSubscribeXmlRenderingCallback.RECEIVED_THE_FOLLOWING_WIN32_ERROR + errorCode); + verify(logger).error("{}{}", EventSubscribeXmlRenderingCallback.RECEIVED_THE_FOLLOWING_WIN32_ERROR, errorCode); } @Test @@ -133,6 +133,6 @@ public class EventSubscribeXmlRenderingCallbackTest { when(kernel32.GetLastError()).thenReturn(value); when(errorLookup.getLastError()).thenReturn(code); eventSubscribeXmlRenderingCallback.onEvent(WEvtApi.EvtSubscribeNotifyAction.DELIVER, null, handle); - verify(logger).error(EventSubscribeXmlRenderingCallback.EVT_RENDER_RETURNED_THE_FOLLOWING_ERROR_CODE + code + "."); + verify(logger).error("{}{}.", EventSubscribeXmlRenderingCallback.EVT_RENDER_RETURNED_THE_FOLLOWING_ERROR_CODE, code); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java b/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java index bd57804a91..e39bd45e85 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-file-authorizer/src/main/java/org/apache/nifi/authorization/FileAccessPolicyProvider.java @@ -572,7 +572,7 @@ public class FileAccessPolicyProvider implements ConfigurableAccessPolicyProvide parseFlow(); if (hasInitialAdminIdentity) { - logger.info("Populating authorizations for Initial Admin: " + initialAdminIdentity); + logger.info("Populating authorizations for Initial Admin: {}", initialAdminIdentity); populateInitialAdmin(authorizations); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java index 12bf3a7fd2..d0b418f5bb 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-authorization-providers/src/main/java/org/apache/nifi/authorization/CompositeUserGroupProvider.java @@ -224,7 +224,7 @@ public class CompositeUserGroupProvider implements UserGroupProvider { userGroupProvider.preDestruction(); } catch (Exception e) { error = e; - logger.error("Error pre-destructing: " + e); + logger.error("Error pre-destructing", e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java index 6aaf866956..747b5a0862 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-protocol/src/main/java/org/apache/nifi/cluster/protocol/impl/SocketProtocolListener.java @@ -153,7 +153,7 @@ public class SocketProtocolListener extends SocketListener implements ProtocolLi if (logger.isDebugEnabled() && wrappedInStream instanceof CopyingInputStream) { final CopyingInputStream copyingInputStream = (CopyingInputStream) wrappedInStream; byte[] receivedMessage = copyingInputStream.getBytesRead(); - logger.debug("Received message: " + new String(receivedMessage)); + logger.debug("Received message: {}", new String(receivedMessage)); } } @@ -205,7 +205,7 @@ public class SocketProtocolListener extends SocketListener implements ProtocolLi tlsErrorLastSeen = System.currentTimeMillis(); } } else { - logger.warn(msg + e, e); + logger.warn(msg, e); publishBulletinWarning(msg + e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java index f50195b940..0539dc5305 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster-zookeeper/src/main/java/org/apache/nifi/framework/cluster/zookeeper/ZooKeeperClientConfig.java @@ -222,7 +222,7 @@ public class ZooKeeperClientConfig { try { return (int) FormatUtils.getTimeDuration(timeout, TimeUnit.MILLISECONDS); } catch (final Exception e) { - logger.warn("Value of '" + propertyName + "' property is set to '" + timeout + "', which is not a valid time period. Using default of " + defaultValue); + logger.warn("Value of '{}' property is set to '{}', which is not a valid time period. Using default of {}", propertyName, timeout, defaultValue); return (int) FormatUtils.getTimeDuration(defaultValue, TimeUnit.MILLISECONDS); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/StandardHttpResponseMapper.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/StandardHttpResponseMapper.java index 041b8d4f2d..0e53c614e2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/StandardHttpResponseMapper.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/http/StandardHttpResponseMapper.java @@ -285,7 +285,7 @@ public class StandardHttpResponseMapper implements HttpResponseMapper { try { ((StreamingOutput) response.getResponse().getEntity()).write(new NullOutputStream()); } catch (final IOException ioe) { - logger.info("Failed clearing out non-client response buffer from " + response.getNodeId() + " due to: " + ioe, ioe); + logger.info("Failed clearing out non-client response buffer from {}", response.getNodeId(), ioe); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java index 71f60c5a43..211edb0147 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-cluster/src/main/java/org/apache/nifi/cluster/coordination/node/NodeClusterCoordinator.java @@ -1084,7 +1084,7 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl return; } catch (final Exception e) { - logger.warn("Problem encountered issuing reconnection request to node " + request.getNodeId(), e); + logger.warn("Problem encountered issuing reconnection request to node {}", request.getNodeId(), e); eventReporter.reportEvent(Severity.WARNING, EVENT_CATEGORY, "Problem encountered issuing reconnection request to node " + request.getNodeId() + " due to: " + e); } @@ -1255,7 +1255,7 @@ public class NodeClusterCoordinator implements ClusterCoordinator, ProtocolHandl if (isBlockedByFirewall(nodeIdentities)) { // if the socket address is not listed in the firewall, then return a null response - logger.info("Firewall blocked connection request from node " + nodeIdentifier + " with Node Identities " + nodeIdentities); + logger.info("Firewall blocked connection request from node {} with Node Identities {}", nodeIdentifier, nodeIdentities); final ConnectionResponse response = ConnectionResponse.createBlockedByFirewallResponse(); final ConnectionResponseMessage responseMessage = new ConnectionResponseMessage(); responseMessage.setConnectionResponse(response); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/components/validation/StandardValidationTrigger.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/components/validation/StandardValidationTrigger.java index 4f1f7dcde0..5cef0cc8c8 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/components/validation/StandardValidationTrigger.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/components/validation/StandardValidationTrigger.java @@ -52,7 +52,7 @@ public class StandardValidationTrigger implements ValidationTrigger { component.performValidation(); } } catch (final Throwable t) { - component.getLogger().error("Failed to perform validation due to " + t, t); + component.getLogger().error("Failed to perform validation", t); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java index 63801b95b2..a48aca3be0 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/StandardProcessorNode.java @@ -1804,7 +1804,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable final SchedulingAgent schedulingAgent, final LifecycleState lifecycleState, final boolean triggerLifecycleMethods) { final Processor processor = processorRef.get().getProcessor(); - LOG.info("Stopping processor: " + this); + LOG.info("Stopping processor: {}", this); desiredState = ScheduledState.STOPPED; final CompletableFuture future = new CompletableFuture<>(); @@ -1881,7 +1881,7 @@ public class StandardProcessorNode extends ProcessorNode implements Connectable executor.schedule(this, 100, TimeUnit.MILLISECONDS); } } catch (final Exception e) { - LOG.warn("Failed while shutting down processor " + processor, e); + LOG.warn("Failed while shutting down processor {}", processor, e); } } }); 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 1aef7ac979..7265dc1d91 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 @@ -352,9 +352,6 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn autoTerminatedEvents.add(dropEvent); } catch (final Exception e) { LOG.warn("Unable to generate Provenance Event for {} on behalf of {}", record.getCurrent(), connectableDescription, e); - if (LOG.isDebugEnabled()) { - LOG.warn("", e); - } } } else { FlowFileRecord currRec = record.getCurrent(); @@ -1271,10 +1268,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { context.getFlowFileRepository().updateRepository(abortedRecords); } catch (final IOException ioe) { - LOG.error("Unable to update FlowFile repository for aborted records due to {}", ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", ioe); - } + LOG.error("Unable to update FlowFile repository for aborted records", ioe); } } @@ -1288,10 +1282,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { context.getFlowFileRepository().updateRepository(Collections.singletonList(repoRecord)); } catch (final IOException ioe) { - LOG.error("Unable to update FlowFile repository to cleanup transient claims due to {}", ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.error("", ioe); - } + LOG.error("Unable to update FlowFile repository to cleanup transient claims", ioe); } } @@ -1305,10 +1296,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { context.getFlowFileEventRepository().updateRepository(flowFileEvent, connectable.getIdentifier()); } catch (final Exception e) { - LOG.error("Failed to update FlowFileEvent Repository due to " + e); - if (LOG.isDebugEnabled()) { - LOG.error("", e); - } + LOG.error("Failed to update FlowFileEvent Repository", e); } acknowledgeRecords(); @@ -2757,7 +2745,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn handleContentNotFound(cnfe, record); throw cnfe; } catch (final FlowFileAccessException ffae) { - LOG.error("Failed to read content from " + sourceFlowFile + "; rolling back session", ffae); + LOG.error("Failed to read content from {}; rolling back session", sourceFlowFile, ffae); close(); rollback(true); throw ffae; @@ -2778,7 +2766,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn handleContentNotFound(cnfe, record); throw cnfe; } catch (final FlowFileAccessException ffae) { - LOG.error("Failed to read content from " + sourceFlowFile + "; rolling back session", ffae); + LOG.error("Failed to read content from {}; rolling back session", sourceFlowFile, ffae); close(); rollback(true); throw ffae; @@ -3002,7 +2990,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { countingOut.write(b); } catch (final IOException ioe) { - LOG.error("Failed to write content to " + sourceFlowFile + "; rolling back session", ioe); + LOG.error("Failed to write content to {}; rolling back session", sourceFlowFile, ioe); rollback(true); close(); throw new FlowFileAccessException("Failed to write to Content Repository for " + sourceFlowFile, ioe); @@ -3014,7 +3002,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { countingOut.write(b); } catch (final IOException ioe) { - LOG.error("Failed to write content to " + sourceFlowFile + "; rolling back session", ioe); + LOG.error("Failed to write content to {}; rolling back session", sourceFlowFile, ioe); rollback(true); close(); throw new FlowFileAccessException("Failed to write to Content Repository for " + sourceFlowFile, ioe); @@ -3026,7 +3014,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { countingOut.write(b, off, len); } catch (final IOException ioe) { - LOG.error("Failed to write content to " + sourceFlowFile + "; rolling back session", ioe); + LOG.error("Failed to write content to {}; rolling back session", sourceFlowFile, ioe); rollback(true); close(); throw new FlowFileAccessException("Failed to write to Content Repository for " + sourceFlowFile, ioe); @@ -3038,7 +3026,7 @@ public class StandardProcessSession implements ProcessSession, ProvenanceEventEn try { countingOut.flush(); } catch (final IOException ioe) { - LOG.error("Failed to write content to " + sourceFlowFile + "; rolling back session", ioe); + LOG.error("Failed to write content to {}; rolling back session", sourceFlowFile, ioe); rollback(true); close(); throw new FlowFileAccessException("Failed to write to Content Repository for " + sourceFlowFile, ioe); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java index 98a70b1e91..3ac141368b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/repository/StandardProvenanceReporter.java @@ -181,10 +181,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { bytesReceived += flowFile.getSize(); flowFilesReceived++; } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -214,10 +211,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { bytesFetched += flowFile.getSize(); flowFilesFetched++; } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -273,10 +267,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { bytesSent += flowFile.getSize(); flowFilesSent++; } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -323,10 +314,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { .setTransitUri(transitUri).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -350,10 +338,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ADDINFO).setAlternateIdentifierUri(alternateIdentifierUri).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -368,10 +353,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { events.add(record); return record; } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); return null; } } @@ -382,10 +364,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.EXPIRE).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -425,10 +404,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -462,10 +438,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -486,10 +459,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { eventBuilder.addParentFlowFile(parent); events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -516,10 +486,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.CONTENT_MODIFIED).setEventDuration(processingMillis).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -536,10 +503,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ATTRIBUTES_MODIFIED).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -566,10 +530,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ROUTE).setRelationship(relationship).setDetails(details).setEventDuration(processingDuration).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -586,10 +547,7 @@ public class StandardProvenanceReporter implements InternalProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.CREATE).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java index 89c7a47b2d..cf4a53d3e2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/controller/service/StandardControllerServiceProvider.java @@ -277,7 +277,7 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi } catch (final ControllerServiceNotValidException csnve) { logger.warn("Failed to enable service {} because it is not currently valid", controllerServiceNode); } catch (Exception e) { - logger.error("Failed to enable " + controllerServiceNode, e); + logger.error("Failed to enable {}", controllerServiceNode, e); if (this.bulletinRepo != null) { this.bulletinRepo.addBulletin(BulletinFactory.createBulletin("Controller Service", Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); @@ -346,7 +346,7 @@ public class StandardControllerServiceProvider implements ControllerServiceProvi } } } catch (Exception e) { - logger.error("Failed to enable " + controllerServiceNode, e); + logger.error("Failed to enable {}", controllerServiceNode, e); if (this.bulletinRepo != null) { this.bulletinRepo.addBulletin(BulletinFactory.createBulletin("Controller Service", Severity.ERROR.name(), "Could not start " + controllerServiceNode + " due to " + e)); diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java index e5c4c027fb..4c860ceadf 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/groups/StandardProcessGroup.java @@ -257,7 +257,7 @@ public final class StandardProcessGroup implements ProcessGroup { final String explicitValue = nifiProperties.getProperty(NiFiProperties.BACKPRESSURE_COUNT, String.valueOf(DEFAULT_BACKPRESSURE_OBJECT)); count = Long.parseLong(explicitValue); } catch (final Exception e) { - LOG.warn("nifi.properties has an invalid value for the '" + NiFiProperties.BACKPRESSURE_COUNT + "' property. Using default value instaed."); + LOG.warn("nifi.properties has an invalid value for the '{}' property. Using default value instead.", NiFiProperties.BACKPRESSURE_COUNT); count = DEFAULT_BACKPRESSURE_OBJECT; } nifiPropertiesBackpressureCount = count; @@ -267,7 +267,7 @@ public final class StandardProcessGroup implements ProcessGroup { size = nifiProperties.getProperty(NiFiProperties.BACKPRESSURE_SIZE, DEFAULT_BACKPRESSURE_DATA_SIZE); DataUnit.parseDataSize(size, DataUnit.B); } catch (final Exception e) { - LOG.warn("nifi.properties has an invalid value for the '" + NiFiProperties.BACKPRESSURE_SIZE + "' property. Using default value instaed."); + LOG.warn("nifi.properties has an invalid value for the '{}' property. Using default value instead.", NiFiProperties.BACKPRESSURE_SIZE); size = DEFAULT_BACKPRESSURE_DATA_SIZE; } nifiPropertiesBackpressureSize = size; diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/ReflectionUtils.java b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/ReflectionUtils.java index 50ed449632..660e2acfac 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/ReflectionUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/util/ReflectionUtils.java @@ -315,7 +315,7 @@ public class ReflectionUtils { try { return invokeMethodsWithAnnotations(true, logger, instance, annotationArray, args); } catch (Exception e) { - LOG.error("Failed while attempting to invoke methods with '" + Arrays.asList(annotationArray) + "' annotations", e); + LOG.error("Failed while attempting to invoke methods with '{}' annotations", Arrays.asList(annotationArray), e); return false; } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java index 5f9e027f27..c0a1398fd9 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/AbstractComponentNode.java @@ -329,13 +329,13 @@ public abstract class AbstractComponentNode implements ComponentNode { // if at least one property with dynamicallyModifiesClasspath(true) was set, then reload the component with the new urls if (classpathChanged || classloaderIsolationKeyChanged) { - logger.info("Updating classpath for " + this.componentType + " with the ID " + this.getIdentifier()); + logger.info("Updating classpath for {} with the ID {}", this.componentType, this.getIdentifier()); final Set additionalUrls = getAdditionalClasspathResources(getComponent().getPropertyDescriptors()); try { reload(additionalUrls); } catch (Exception e) { - getLogger().error("Error reloading component with id " + id + ": " + e.getMessage(), e); + getLogger().error("Error reloading component with id {}", id, e); } } } @@ -936,17 +936,17 @@ public abstract class AbstractComponentNode implements ComponentNode { return validationResults; } catch (final ControllerServiceDisabledException e) { - getLogger().debug("Failed to perform validation due to " + e, e); + getLogger().debug("Failed to perform validation", e); return Collections.singleton( new DisabledServiceValidationResult("Component", e.getControllerServiceId(), "performing validation depends on referencing a Controller Service that is currently disabled")); } catch (final Exception e) { // We don't want to log this as an error because we will return a ValidationResult that is // invalid. However, we do want to make the stack trace available if needed, so we log it at // a debug level. - getLogger().debug("Failed to perform validation due to " + e, e); + getLogger().debug("Failed to perform validation", e); failureCause = e; } catch (final Error e) { - getLogger().error("Failed to perform validation due to " + e, e); + getLogger().error("Failed to perform validation", e); failureCause = e; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ComponentNode.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ComponentNode.java index 335288f928..f6231bbb7b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ComponentNode.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/controller/ComponentNode.java @@ -326,7 +326,7 @@ public interface ComponentNode extends ComponentAuthorizable { try { return ((ClassloaderIsolationKeyProvider) component).getClassloaderIsolationKey(context); } catch (final Exception e) { - getLogger().error("Failed to determine ClassLoader Isolation Key for " + this + ". This could result in unexpected behavior by this processor.", e); + getLogger().error("Failed to determine ClassLoader Isolation Key for {}. This could result in unexpected behavior by this processor.", this, e); return null; } } 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 e5969a0bf8..1f970b330d 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 @@ -305,7 +305,7 @@ public class ExtensionBuilder { try { loggableComponent = createLoggableFlowRegistryClient(); } catch (final FlowRepositoryClientInstantiationException e) { - logger.error("Could not create Flow Registry Component of type " + type + " for ID " + identifier + "; creating \"Ghost\" implementation", e); + logger.error("Could not create Flow Registry Component of type {} for ID {}; creating \"Ghost\" implementation", type, identifier, e); final GhostFlowRegistryClient ghostFlowRegistryClient = new GhostFlowRegistryClient(identifier, type); loggableComponent = new LoggableComponent<>(ghostFlowRegistryClient, bundleCoordinate, null); creationSuccessful = false; @@ -346,7 +346,7 @@ public class ExtensionBuilder { try { loggableComponent = createLoggableReportingTask(); } catch (final ReportingTaskInstantiationException rtie) { - logger.error("Could not create ReportingTask of type " + type + " for ID " + identifier + "; creating \"Ghost\" implementation", rtie); + logger.error("Could not create ReportingTask of type {} for ID {}; creating \"Ghost\" implementation", type, identifier, rtie); final GhostReportingTask ghostReportingTask = new GhostReportingTask(); ghostReportingTask.setIdentifier(identifier); ghostReportingTask.setCanonicalClassName(type); @@ -389,7 +389,7 @@ public class ExtensionBuilder { try { loggableComponent = createLoggableParameterProvider(); } catch (final ParameterProviderInstantiationException rtie) { - logger.error("Could not create ParameterProvider of type " + type + " for ID " + identifier + "; creating \"Ghost\" implementation", rtie); + logger.error("Could not create ParameterProvider of type {} for ID {}; creating \"Ghost\" implementation", type, identifier, rtie); final GhostParameterProvider ghostParameterProvider = new GhostParameterProvider(); ghostParameterProvider.setIdentifier(identifier); ghostParameterProvider.setCanonicalClassName(type); @@ -430,7 +430,7 @@ public class ExtensionBuilder { try { return createControllerServiceNode(loggingContext); } catch (final Exception e) { - logger.error("Could not create Controller Service of type " + type + " for ID " + identifier + " due to: " + e.getMessage() + "; creating \"Ghost\" implementation"); + logger.error("Could not create Controller Service of type {} for ID {}; creating \"Ghost\" implementation", type, identifier, e); if (logger.isDebugEnabled()) { logger.debug(e.getMessage(), e); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java index 2b56cedb7b..cbe56ebd06 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/FileSystemSwapManager.java @@ -293,7 +293,7 @@ public class FileSystemSwapManager implements FlowFileSwapManager { for (final File swapFile : swapFiles) { if (TEMP_SWAP_FILE_PATTERN.matcher(swapFile.getName()).matches()) { if (swapFile.delete()) { - logger.info("Removed incomplete/temporary Swap File " + swapFile); + logger.info("Removed incomplete/temporary Swap File {}", swapFile); } else { warn("Failed to remove incomplete/temporary Swap File " + swapFile + "; this file should be cleaned up manually"); } 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 d041b98562..f4ec22df04 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 @@ -646,7 +646,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr } if (remoteInputHttpPort == null) { - LOG.info("Not enabling HTTP(S) Site-to-Site functionality because the '" + NiFiProperties.SITE_TO_SITE_HTTP_ENABLED + "' property is not true"); + LOG.debug("Not enabling HTTP(S) Site-to-Site functionality because the '{}' property is not true", NiFiProperties.SITE_TO_SITE_HTTP_ENABLED); } else { externalSiteListeners.add(HttpRemoteSiteListener.getInstance(nifiProperties)); } @@ -686,8 +686,8 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr try { predictionIntervalMillis = FormatUtils.getTimeDuration(predictionInterval, TimeUnit.MILLISECONDS); } catch (final Exception e) { - LOG.warn("Analytics is enabled however could not retrieve value for " + NiFiProperties.ANALYTICS_PREDICTION_INTERVAL + ". This property has been set to '" - + NiFiProperties.DEFAULT_ANALYTICS_PREDICTION_INTERVAL + "'"); + LOG.warn("Analytics is enabled however could not retrieve value for {}. This property has been set to '{}'", + NiFiProperties.ANALYTICS_PREDICTION_INTERVAL, NiFiProperties.DEFAULT_ANALYTICS_PREDICTION_INTERVAL); predictionIntervalMillis = FormatUtils.getTimeDuration(NiFiProperties.DEFAULT_ANALYTICS_PREDICTION_INTERVAL, TimeUnit.MILLISECONDS); } @@ -697,8 +697,8 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr try { queryIntervalMillis = FormatUtils.getTimeDuration(queryInterval, TimeUnit.MILLISECONDS); } catch (final Exception e) { - LOG.warn("Analytics is enabled however could not retrieve value for " + NiFiProperties.ANALYTICS_QUERY_INTERVAL + ". This property has been set to '" - + NiFiProperties.DEFAULT_ANALYTICS_QUERY_INTERVAL + "'"); + LOG.warn("Analytics is enabled however could not retrieve value for {}. This property has been set to '{}'", + NiFiProperties.ANALYTICS_QUERY_INTERVAL, NiFiProperties.DEFAULT_ANALYTICS_QUERY_INTERVAL); queryIntervalMillis = FormatUtils.getTimeDuration(NiFiProperties.DEFAULT_ANALYTICS_QUERY_INTERVAL, TimeUnit.MILLISECONDS); } @@ -711,8 +711,8 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr modelScoreThreshold = Double.valueOf(nifiProperties.getProperty(NiFiProperties.ANALYTICS_CONNECTION_MODEL_SCORE_THRESHOLD, Double.toString(NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_SCORE_THRESHOLD))); } catch (final Exception e) { - LOG.warn("Analytics is enabled however could not retrieve value for " + NiFiProperties.ANALYTICS_CONNECTION_MODEL_SCORE_THRESHOLD + ". This property has been set to '" - + NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_SCORE_THRESHOLD + "'."); + LOG.warn("Analytics is enabled however could not retrieve value for {}. This property has been set to '{}'.", + NiFiProperties.ANALYTICS_CONNECTION_MODEL_SCORE_THRESHOLD, NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_SCORE_THRESHOLD); modelScoreThreshold = NiFiProperties.DEFAULT_ANALYTICS_CONNECTION_SCORE_THRESHOLD; } @@ -1073,10 +1073,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr try { updateRemoteProcessGroups(); } catch (final Throwable t) { - LOG.warn("Unable to update Remote Process Groups due to " + t); - if (LOG.isDebugEnabled()) { - LOG.warn("", t); - } + LOG.warn("Unable to update Remote Process Groups", t); } } }, 0L, 30L, TimeUnit.SECONDS); @@ -1527,7 +1524,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr LOG.info("Initiated immediate shutdown of flow controller..."); } else { this.timerDrivenEngineRef.get().shutdown(); - LOG.info("Initiated graceful shutdown of flow controller...waiting up to " + gracefulShutdownSeconds + " seconds"); + LOG.info("Initiated graceful shutdown of flow controller...waiting up to {} seconds", gracefulShutdownSeconds); } try { @@ -1585,10 +1582,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr try { provenanceRepository.close(); } catch (final IOException ioe) { - LOG.warn("There was a problem shutting down the Provenance Repository: " + ioe.toString()); - if (LOG.isDebugEnabled()) { - LOG.warn("", ioe); - } + LOG.warn("There was a problem shutting down the Provenance Repository", ioe); } } @@ -3224,10 +3218,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr LOG.debug(usae.getMessage()); } } catch (final Throwable ex) { - LOG.warn("Failed to send heartbeat due to: " + ex); - if (LOG.isDebugEnabled()) { - LOG.warn("", ex); - } + LOG.warn("Failed to send heartbeat", ex); } } } @@ -3265,7 +3256,7 @@ public class FlowController implements ReportingTaskProvider, FlowAnalysisRulePr return message; } catch (final Throwable ex) { - LOG.warn("Failed to create heartbeat due to: " + ex, ex); + LOG.warn("Failed to create heartbeat", ex); return null; } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java index b1c9f06035..4b654b3b8a 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardFlowService.java @@ -319,7 +319,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { try { senderListener.stop(); } catch (final IOException ioe) { - logger.warn("Protocol sender/listener did not stop gracefully due to: " + ioe); + logger.warn("Protocol sender/listener did not stop gracefully", ioe); } } } finally { @@ -342,7 +342,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { } if (!graceful) { - logger.warn("Scheduling service did not gracefully shutdown within configured " + gracefulShutdownSeconds + " second window"); + logger.warn("Scheduling service did not gracefully shutdown within configured {} second window", gracefulShutdownSeconds); } } @@ -435,7 +435,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { // Create the initial flow from disk if it exists, or from serializing the empty root group in flow controller final DataFlow initialFlow = (dataFlow == null) ? createDataFlow() : dataFlow; if (logger.isTraceEnabled()) { - logger.trace("InitialFlow = " + new String(initialFlow.getFlow(), StandardCharsets.UTF_8)); + logger.trace("InitialFlow = {}", new String(initialFlow.getFlow(), StandardCharsets.UTF_8)); } // Sync the initial flow into the flow controller so that if the flow came from disk we loaded the @@ -450,7 +450,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { // Get the proposed flow by serializing the flow controller which now has the synced version from above final DataFlow proposedFlow = createDataFlowFromController(); if (logger.isTraceEnabled()) { - logger.trace("ProposedFlow = " + new String(proposedFlow.getFlow(), StandardCharsets.UTF_8)); + logger.trace("ProposedFlow = {}", new String(proposedFlow.getFlow(), StandardCharsets.UTF_8)); } /* @@ -507,7 +507,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { try { loadFromConnectionResponse(response); } catch (final Exception e) { - logger.error("Failed to load flow from cluster due to: " + e, e); + logger.error("Failed to load flow from cluster", e); handleConnectionFailure(e); throw new IOException(e); } @@ -667,20 +667,20 @@ public class StandardFlowService implements FlowService, ProtocolHandler { disconnect("Failed to properly handle Reconnection request due to " + ex.toString()); } - logger.error("Handling reconnection request failed due to: " + ex, ex); + logger.error("Handling reconnection request failed", ex); handleConnectionFailure(ex); } } private void handleOffloadRequest(final OffloadMessage request) throws InterruptedException { - logger.info("Received offload request message from cluster coordinator with explanation: " + request.getExplanation()); + logger.info("Received offload request message from cluster coordinator with explanation: {}", request.getExplanation()); offload(request.getExplanation()); } private void offload(final String explanation) throws InterruptedException { writeLock.lock(); try { - logger.info("Offloading node due to " + explanation); + logger.info("Offloading node due to {}", explanation); // mark node as offloading controller.setConnectionStatus(new NodeConnectionStatus(nodeId, NodeConnectionState.OFFLOADING, OffloadCode.OFFLOADED, explanation)); @@ -735,7 +735,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { controller.setConnectionStatus(new NodeConnectionStatus(nodeId, NodeConnectionState.OFFLOADED, OffloadCode.OFFLOADED, explanation)); clusterCoordinator.finishNodeOffload(getNodeId()); - logger.info("Node offloaded due to " + explanation); + logger.info("Node offloaded due to {}", explanation); } finally { writeLock.unlock(); @@ -743,7 +743,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { } private void handleDisconnectionRequest(final DisconnectMessage request) { - logger.info("Received disconnection request message from cluster coordinator with explanation: " + request.getExplanation()); + logger.info("Received disconnection request message from cluster coordinator with explanation: {}", request.getExplanation()); disconnect(request.getExplanation()); } @@ -751,7 +751,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { writeLock.lock(); try { - logger.info("Disconnecting node due to " + explanation); + logger.info("Disconnecting node due to {}", explanation); // mark node as not connected controller.setConnectionStatus(new NodeConnectionStatus(nodeId, DisconnectionCode.UNKNOWN, explanation)); @@ -766,7 +766,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { controller.setClustered(false, null); clusterCoordinator.setConnected(false); - logger.info("Node disconnected due to " + explanation); + logger.info("Node disconnected due to {}", explanation); } finally { writeLock.unlock(); @@ -813,7 +813,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { private ConnectionResponse connect(final boolean retryOnCommsFailure, final boolean retryIndefinitely, final DataFlow dataFlow) throws ConnectionException { readLock.lock(); try { - logger.info("Connecting Node: " + nodeId); + logger.info("Connecting Node: {}", nodeId); // create connection request message final ConnectionRequest request = new ConnectionRequest(nodeId, dataFlow); @@ -854,7 +854,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { response = senderListener.requestConnection(requestMsg, activeCoordinatorParticipant).getConnectionResponse(); if (response.shouldTryLater()) { - logger.info("Requested by cluster coordinator to retry connection in " + response.getTryLaterSeconds() + " seconds with explanation: " + response.getRejectionReason()); + logger.info("Requested by cluster coordinator to retry connection in {} seconds with explanation: {}", response.getTryLaterSeconds(), response.getRejectionReason()); try { Thread.sleep(response.getTryLaterSeconds() * 1000); } catch (final InterruptedException ie) { @@ -863,7 +863,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { break; } } else if (response.getRejectionReason() != null) { - logger.warn("Connection request was blocked by cluster coordinator with the explanation: " + response.getRejectionReason()); + logger.warn("Connection request was blocked by cluster coordinator with the explanation: {}", response.getRejectionReason()); // set response to null and treat a firewall blockage the same as getting no response from cluster coordinator response = null; break; @@ -885,7 +885,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { } } catch (final Exception pe) { // could not create a socket and communicate with manager - logger.warn("Failed to connect to cluster due to: " + pe); + logger.warn("Failed to connect to cluster", pe); if (logger.isDebugEnabled()) { logger.warn("", pe); } @@ -943,10 +943,10 @@ public class StandardFlowService implements FlowService, ProtocolHandler { // get the dataflow from the response final DataFlow dataFlow = response.getDataFlow(); if (logger.isTraceEnabled()) { - logger.trace("ResponseFlow = " + new String(dataFlow.getFlow(), StandardCharsets.UTF_8)); + logger.trace("ResponseFlow = {}", new String(dataFlow.getFlow(), StandardCharsets.UTF_8)); } - logger.info("Setting Flow Controller's Node ID: " + nodeId); + logger.info("Setting Flow Controller's Node ID: {}", nodeId); nodeId = response.getNodeIdentifier(); controller.setNodeId(nodeId); @@ -1072,10 +1072,7 @@ public class StandardFlowService implements FlowService, ProtocolHandler { } } } catch (final Throwable t) { - logger.error("Unable to save flow controller configuration due to: " + t, t); - if (logger.isDebugEnabled()) { - logger.error("", t); - } + logger.error("Unable to save flow controller configuration", t); // record the failed save as a bulletin final Bulletin saveFailureBulletin = BulletinFactory.createBulletin(EVENT_CATEGORY, LogLevel.ERROR.name(), "Unable to save flow controller configuration."); 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 aad2228492..1fd81047f3 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 @@ -1119,7 +1119,7 @@ public class SwappablePriorityQueue { || newSize.getSwappedBytes() < 0 || newSize.getSwappedCount() < 0 || newSize.getUnacknowledgedBytes() < 0 || newSize.getUnacknowledgedCount() < 0) { - logger.error("Updated Size of Queue " + counterName + " from " + original + " to " + newSize, new RuntimeException("Cannot create negative queue size")); + logger.error("Updated Size of Queue {} from {} to {}", counterName, original, newSize, new RuntimeException("Cannot create negative queue size")); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/server/StandardLoadBalanceProtocol.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/server/StandardLoadBalanceProtocol.java index 416de73994..d59f62770b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/server/StandardLoadBalanceProtocol.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/queue/clustered/server/StandardLoadBalanceProtocol.java @@ -308,8 +308,8 @@ public class StandardLoadBalanceProtocol implements LoadBalanceProtocol { } if (completionIndicator != COMPLETE_TRANSACTION) { - logger.debug("Expected to receive Transaction Completion Indicator from Peer " + peerDescription + " but instead received a value of " + completionIndicator + ". Sending back an Abort " + - "Transaction Flag."); + logger.debug("Expected to receive Transaction Completion Indicator from Peer {} but instead received a value of {}. Sending back an Abort Transaction Flag.", + peerDescription, completionIndicator); out.write(ABORT_TRANSACTION); out.flush(); throw new IOException("Expected to receive Transaction Completion Indicator from Peer " + peerDescription + " but instead received a value of " + completionIndicator); 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 df207ea6b8..a8f4d6462e 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 @@ -1147,7 +1147,7 @@ public class FileSystemRepository implements ContentRepository { try { out.close(); } catch (final IOException ioe) { - LOG.warn("Unable to close Output Stream for " + claim, ioe); + LOG.warn("Unable to close Output Stream for {}", claim, ioe); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/WriteAheadFlowFileRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/WriteAheadFlowFileRepository.java index 455a07633f..cacb206fd4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/WriteAheadFlowFileRepository.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/WriteAheadFlowFileRepository.java @@ -278,7 +278,7 @@ public class WriteAheadFlowFileRepository implements FlowFileRepository, SyncLis } } } catch (final Exception e) { - logger.warn("Failed to read swap file " + swapLocation + " when attempting to find resource claim references", e); + logger.warn("Failed to read swap file {} when attempting to find resource claim references", swapLocation, e); } } @@ -853,7 +853,7 @@ public class WriteAheadFlowFileRepository implements FlowFileRepository, SyncLis final long millis = TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS); logger.info("Successfully checkpointed FlowFile Repository with {} records in {} milliseconds", numRecordsCheckpointed, millis); } catch (final Throwable t) { - logger.error("Unable to checkpoint FlowFile Repository due to " + t.toString(), t); + logger.error("Unable to checkpoint FlowFile Repository", t); } } }; diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/crypto/EncryptedFileSystemRepository.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/crypto/EncryptedFileSystemRepository.java index 1a5ae004c9..4eefbcec95 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/crypto/EncryptedFileSystemRepository.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/repository/crypto/EncryptedFileSystemRepository.java @@ -214,7 +214,7 @@ public class EncryptedFileSystemRepository extends FileSystemRepository { return "nifi-ecr-rc-" + claim.getResourceClaim().getId() + "+" + claim.getOffset(); } else { final String tempId = "nifi-ecr-ts-" + System.nanoTime(); - logger.error("Cannot determine record ID from null content claim or claim with missing/empty resource claim ID; using timestamp-generated ID [{}]", tempId + "+0"); + logger.error("Cannot determine record ID from null content claim or claim with missing/empty resource claim ID; using timestamp-generated ID [{}+0]", tempId); return tempId; } } 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 34b8488112..2a4e601537 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 @@ -793,7 +793,7 @@ public final class StandardProcessScheduler implements ProcessScheduler { @Override public CompletableFuture enableControllerService(final ControllerServiceNode service) { - LOG.info("Enabling " + service); + LOG.info("Enabling {}", service); return service.enable(this.componentLifeCycleThreadPool, this.administrativeYieldMillis); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/BootstrapDiagnosticsFactory.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/BootstrapDiagnosticsFactory.java index 10679f7df3..994aafddcb 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/BootstrapDiagnosticsFactory.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/diagnostics/bootstrap/BootstrapDiagnosticsFactory.java @@ -62,7 +62,7 @@ public class BootstrapDiagnosticsFactory implements DiagnosticsFactory { dumpElements.add(dumpElement); } } catch (final Exception e) { - logger.error("Failed to obtain diagnostics information from " + dumpTask.getClass(), e); + logger.error("Failed to obtain diagnostics information from {}", dumpTask.getClass(), e); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/persistence/StandardFlowConfigurationDAO.java b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/persistence/StandardFlowConfigurationDAO.java index a327bf8209..f07f076a90 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/persistence/StandardFlowConfigurationDAO.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/persistence/StandardFlowConfigurationDAO.java @@ -191,10 +191,7 @@ public final class StandardFlowConfigurationDAO implements FlowConfigurationDAO try { archiveManager.archive(file); } catch (final Exception ex) { - LOG.error("Unable to archive flow configuration as requested due to " + ex); - if (LOG.isDebugEnabled()) { - LOG.error("", ex); - } + LOG.error("Unable to archive flow configuration as requested ", ex); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarAutoLoaderTask.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarAutoLoaderTask.java index 82ba9f6c16..5975910648 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarAutoLoaderTask.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/NarAutoLoaderTask.java @@ -129,7 +129,7 @@ public class NarAutoLoaderTask implements Runnable { } } catch (final Throwable t) { - LOGGER.error("Error loading NARs due to: " + t.getMessage(), t); + LOGGER.error("Error loading NARs", t); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/StandardNarLoader.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/StandardNarLoader.java index 512da49a55..4c551c6913 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/StandardNarLoader.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-loading-utils/src/main/java/org/apache/nifi/nar/StandardNarLoader.java @@ -165,7 +165,7 @@ public class StandardNarLoader implements NarLoader { return unpackedExtension; } catch (Exception e) { - LOGGER.error("Error unpacking " + narFile.getAbsolutePath(), e); + LOGGER.error("Error unpacking {}", narFile.getAbsolutePath(), e); return null; } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/InstanceClassLoader.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/InstanceClassLoader.java index b024bb523b..9d5430f7a3 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/InstanceClassLoader.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/InstanceClassLoader.java @@ -111,7 +111,7 @@ public class InstanceClassLoader extends AbstractNativeLibHandlingClassLoader { final URI uri = url.toURI(); final File file = new File(uri); if (name.equals(file.getName())) { - logger.debug("Found resource '" + name + "' from URL '" + url.toExternalForm() + "'"); + logger.debug("Found resource '{}' from URL '{}'", name, url.toExternalForm()); return url; } } catch (URISyntaxException e) { @@ -136,7 +136,7 @@ public class InstanceClassLoader extends AbstractNativeLibHandlingClassLoader { } catch (URISyntaxException e) { file = new File(url.getPath()); } catch (Exception e) { - logger.error("Couldn't convert url '" + url + "' to a file"); + logger.error("Couldn't convert url '{}' to a file", url); file = null; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java index 3e293cd3d3..d692c68785 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java +++ b/nifi-framework-bundle/nifi-framework/nifi-framework-nar-utils/src/main/java/org/apache/nifi/nar/NarCloseable.java @@ -84,7 +84,7 @@ public class NarCloseable implements Closeable { frameworkClassLoader = NarClassLoadersHolder.getInstance().getFrameworkBundle().getClassLoader(); } catch (final Exception e) { // This should never happen in a running instance, but it will occur in unit tests - logger.error("Unable to access Framework ClassLoader due to " + e + ". Will continue without changing ClassLoaders."); + logger.error("Unable to access Framework ClassLoader. Will continue without changing ClassLoaders.", e); if (logger.isDebugEnabled()) { logger.error("", e); } 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 356f92db96..4e951d57dc 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 @@ -654,7 +654,7 @@ public class StandardExtensionDiscoveringManager implements ExtensionDiscovering try { urlClassLoader.close(); } catch (IOException e) { - logger.warn("Unable to close URLClassLoader for " + instanceIdentifier); + logger.warn("Unable to close URLClassLoader for {}", instanceIdentifier); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoader.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoader.java index 3f3d648e42..b0ddc5257b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoader.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/AbstractNativeLibHandlingClassLoader.java @@ -145,7 +145,7 @@ public abstract class AbstractNativeLibHandlingClassLoader extends URLClassLoade tempFile = Files.createTempFile(tmpLibFilePrefix + "_", "_" + libname); Files.copy(Paths.get(libraryOriginalPathString), tempFile, REPLACE_EXISTING); } catch (Exception e) { - logger.error("Couldn't create temporary copy of the library '" + libname + "' found at '" + libraryOriginalPathString + "'", e); + logger.error("Couldn't create temporary copy of the library '{}' found at '{}'", libname, libraryOriginalPathString, e); tempFile = null; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoader.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoader.java index 5c1abe281f..f3f9b677f0 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoader.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoader.java @@ -196,7 +196,7 @@ public class NarClassLoader extends AbstractNativeLibHandlingClassLoader { File dependencies = new File(root, "NAR-INF/bundled-dependencies"); if (!dependencies.isDirectory()) { - LOGGER.warn(narWorkingDirectory + " does not contain NAR-INF/bundled-dependencies!"); + LOGGER.warn("{} does not contain NAR-INF/bundled-dependencies!", narWorkingDirectory); } addURL(dependencies.toURI().toURL()); if (dependencies.isDirectory()) { @@ -225,7 +225,7 @@ public class NarClassLoader extends AbstractNativeLibHandlingClassLoader { private static File getNARNativeLibDir(File narWorkingDirectory) { File dependencies = new File(narWorkingDirectory, "NAR-INF/bundled-dependencies"); if (!dependencies.isDirectory()) { - LOGGER.warn(narWorkingDirectory + " does not contain NAR-INF/bundled-dependencies!"); + LOGGER.warn("{} does not contain NAR-INF/bundled-dependencies!", narWorkingDirectory); } return new File(dependencies, "native"); diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java index a867dd5e50..aecb846fda 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/nar/NarClassLoaders.java @@ -452,8 +452,7 @@ public final class NarClassLoaders { final String existingNarWorkingDir = existingBundleDetails.getWorkingDirectory().getCanonicalPath(); final String unpackedNarWorkingDir = narDetail.getWorkingDirectory().getCanonicalPath(); - logger.error("Unable to load NAR with coordinates {} and working directory {} " + - "because another NAR with the same coordinates already exists at {}", + logger.error("Unable to load NAR with coordinates {} and working directory {} because another NAR with the same coordinates already exists at {}", unpackedNarCoordinate, unpackedNarWorkingDir, existingNarWorkingDir); } else { narDetails.add(narDetail); @@ -476,7 +475,7 @@ public final class NarClassLoaders { * @throws ClassNotFoundException cfne */ private static ClassLoader createNarClassLoader(final File narDirectory, final ClassLoader parentClassLoader, final boolean log) throws IOException, ClassNotFoundException { - logger.debug("Loading NAR file: " + narDirectory.getAbsolutePath()); + logger.debug("Loading NAR file: {}", narDirectory.getAbsolutePath()); final ClassLoader narClassLoader = new NarClassLoader(narDirectory, parentClassLoader); if (log) { diff --git a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java index da6968d39e..ad06041c57 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java +++ b/nifi-framework-bundle/nifi-framework/nifi-nar-utils/src/main/java/org/apache/nifi/util/FileUtils.java @@ -97,12 +97,12 @@ public class FileUtils { } } if (!isGone && logger != null) { - logger.warn("File appears to exist but unable to delete file: " + file.getAbsolutePath()); + logger.warn("File appears to exist but unable to delete file: {}", file.getAbsolutePath()); } } } catch (final Throwable t) { if (logger != null) { - logger.warn("Unable to delete file: '" + file.getAbsolutePath() + "' due to " + t); + logger.warn("Unable to delete file: '{}'", file.getAbsolutePath(), t); } } return isGone; diff --git a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java index 308b938e56..9b7705791b 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java +++ b/nifi-framework-bundle/nifi-framework/nifi-runtime/src/main/java/org/apache/nifi/BootstrapListener.java @@ -111,7 +111,7 @@ public class BootstrapListener { commandBuilder.append("\n"); final String commandWithArgs = commandBuilder.toString(); - logger.debug("Sending command to Bootstrap: " + commandWithArgs); + logger.debug("Sending command to Bootstrap: {}", commandWithArgs); final OutputStream out = socket.getOutputStream(); out.write((commandWithArgs).getBytes(StandardCharsets.UTF_8)); @@ -272,22 +272,22 @@ public class BootstrapListener { logger.debug("Received IS_LOADED request from Bootstrap"); String answer = String.valueOf(nifiLoaded); sendAnswer(socket.getOutputStream(), answer); - logger.debug("Responded to IS_LOADED request from Bootstrap with value: " + answer); + logger.debug("Responded to IS_LOADED request from Bootstrap with value: {}", answer); break; } } catch (final Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t.toString(), t); + logger.error("Failed to process request from Bootstrap", t); } finally { try { socket.close(); } catch (final IOException ioe) { - logger.warn("Failed to close socket to Bootstrap due to {}", ioe.toString()); + logger.warn("Failed to close socket to Bootstrap", ioe); } } } }); } catch (final Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t.toString(), t); + logger.error("Failed to process request from Bootstrap", t); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java b/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java index 3e06a364f9..bd51f6676e 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java +++ b/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/ShellUserGroupProvider.java @@ -90,7 +90,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { @Override public Set getUsers() throws AuthorizationAccessException { synchronized (usersById) { - logger.debug("getUsers has user set of size: " + usersById.size()); + logger.debug("getUsers has user set of size: {}", usersById.size()); return new HashSet<>(usersById.values()); } } @@ -111,9 +111,9 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (user == null) { - logger.debug("getUser (by id) user not found: " + identifier); + logger.debug("getUser (by id) user not found: {}", identifier); } else { - logger.debug("getUser (by id) found user: " + user + " for id: " + identifier); + logger.debug("getUser (by id) found user: {} for id: {}", user, identifier); } return user; } @@ -134,9 +134,9 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (user == null) { - logger.debug("getUser (by name) user not found: " + identity); + logger.debug("getUser (by name) user not found: {}", identity); } else { - logger.debug("getUser (by name) found user: " + user.getIdentity() + " for name: " + identity); + logger.debug("getUser (by name) found user: {} for name: {}", user.getIdentity(), identity); } return user; } @@ -150,7 +150,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { @Override public Set getGroups() throws AuthorizationAccessException { synchronized (groupsById) { - logger.debug("getGroups has group set of size: " + groupsById.size()); + logger.debug("getGroups has group set of size: {}", groupsById.size()); return new HashSet<>(groupsById.values()); } } @@ -171,7 +171,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (group == null) { - logger.debug("getGroup (by id) group not found: " + identifier); + logger.debug("getGroup (by id) group not found: {}", identifier); } else { logger.debug("getGroup (by id) found group: {} for id: {}", group.getName(), identifier); } @@ -188,7 +188,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (group == null) { - logger.debug("getGroup (by name) group not found: " + name); + logger.debug("getGroup (by name) group not found: {}", name); } else { logger.debug("getGroup (by name) found group: {} for name: {}", group.getName(), name); } @@ -271,7 +271,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { try { shellRunner.runShell(commands.getSystemCheck(), "Supported System Check"); } catch (final Exception e) { - logger.error("initialize exception: " + e + " system check command: " + commands.getSystemCheck()); + logger.error("initialize exception: system check command: {}", commands.getSystemCheck(), e); throw new AuthorizerCreationException(SYS_CHECK_ERROR, e); } @@ -385,12 +385,12 @@ public class ShellUserGroupProvider implements UserGroupProvider { try { scheduler.shutdownNow(); } catch (final Exception e) { - logger.warn("Error shutting down refresh scheduler: " + e.getMessage(), e); + logger.warn("Error shutting down refresh scheduler", e); } try { shellRunner.shutdown(); } catch (final Exception e) { - logger.warn("Error shutting down ShellRunner: " + e.getMessage(), e); + logger.warn("Error shutting down ShellRunner", e); } } @@ -422,7 +422,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { userLines = shellRunner.runShell(selectedShellCommands.getUsersList(), "Get Users List"); groupLines = shellRunner.runShell(selectedShellCommands.getGroupsList(), "Get Groups List"); } catch (final IOException ioexc) { - logger.error("refreshUsersAndGroups shell exception: " + ioexc); + logger.error("refreshUsersAndGroups shell exception", ioexc); return; } @@ -438,33 +438,33 @@ public class ShellUserGroupProvider implements UserGroupProvider { logger.trace("=== Users by id..."); Set sortedUsers = new TreeSet<>(Comparator.comparing(User::getIdentity)); sortedUsers.addAll(usersById.values()); - sortedUsers.forEach(u -> logger.trace("=== " + u.toString())); + sortedUsers.forEach(u -> logger.trace("=== {}", u)); } } synchronized (usersByName) { usersByName.clear(); usersByName.putAll(usernameToUser); - logger.debug("users now size: " + usersByName.size()); + logger.debug("users now size: {}", usersByName.size()); } synchronized (groupsById) { groupsById.clear(); groupsById.putAll(gidToGroup); - logger.debug("groupsById now size: " + groupsById.size()); + logger.debug("groupsById now size: {}", groupsById.size()); if (logger.isTraceEnabled()) { logger.trace("=== Groups by id..."); Set sortedGroups = new TreeSet<>(Comparator.comparing(Group::getName)); sortedGroups.addAll(groupsById.values()); - sortedGroups.forEach(g -> logger.trace("=== " + g.toString())); + sortedGroups.forEach(g -> logger.trace("=== {}", g)); } } synchronized (groupsByName) { groupsByName.clear(); gidToGroup.values().forEach(g -> groupsByName.put(g.getName(), g)); - logger.debug("groupsByName now size: " + groupsByName.size()); + logger.debug("groupsByName now size: {}", groupsByName.size()); } final long endTime = System.currentTimeMillis(); @@ -504,11 +504,11 @@ public class ShellUserGroupProvider implements UserGroupProvider { gidToUser.put(group.getIdentifier(), user); logger.debug("Associated primary group {} with user {}", group.getIdentifier(), userIdentity); } else { - logger.warn("Null or empty primary group id for: " + userIdentity); + logger.warn("Null or empty primary group id for: {}", userIdentity); } } else { - logger.warn("Null, empty, or skipped user name: " + userIdentity + " or id: " + userIdentifier); + logger.warn("Null, empty, or skipped user name: {} or id: {}", userIdentity, userIdentifier); } } else { logger.warn("Unexpected record format. Expected 3 or more colon separated values per line."); @@ -564,7 +564,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { } } catch (final IOException ioexc) { - logger.error("list membership shell exception: " + ioexc); + logger.error("list membership shell exception", ioexc); } if (!StringUtils.isBlank(groupIdentifier) && !StringUtils.isBlank(groupName) && !excludeGroups.matcher(groupName).matches()) { @@ -576,7 +576,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { groupsById.put(group.getIdentifier(), group); logger.debug("Refreshed group {}", group); } else { - logger.warn("Null, empty, or skipped group name: " + groupName + " or id: " + groupIdentifier); + logger.warn("Null, empty, or skipped group name: {} or id: {}", groupName, groupIdentifier); } } else { logger.warn("Unexpected record format. Expected 1 or more comma separated values."); diff --git a/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/util/ShellRunner.java b/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/util/ShellRunner.java index 5c9ffd1045..fa1eceedf4 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/util/ShellRunner.java +++ b/nifi-framework-bundle/nifi-framework/nifi-shell-authorizer/src/main/java/org/apache/nifi/authorization/util/ShellRunner.java @@ -72,7 +72,7 @@ public class ShellRunner { int lineCount = 0; while ((line = reader.readLine()) != null) { if (logger.isTraceEnabled()) { - logger.trace((++lineCount) + " - " + line); + logger.trace("{} - {}", (++lineCount), line); } lines.add(line.trim()); } @@ -96,7 +96,7 @@ public class ShellRunner { try { proc.destroyForcibly(); } catch (Exception e) { - logger.debug("Process failed to destroy: " + e.getMessage(), e); + logger.debug("Process failed to destroy", e); } throw new IllegalStateException("Shell command '" + command + "' did not complete during the allotted time period"); } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java index 3e53054125..97337d63e2 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/HostHeaderHandler.java @@ -289,14 +289,14 @@ public class HostHeaderHandler extends Handler.Abstract { try { final NetworkInterface ni = NetworkInterface.getByName(networkInterfaceName); if (ni == null) { - logger.warn("Cannot resolve network interface named " + networkInterfaceName); + logger.warn("Cannot resolve network interface named {}", networkInterfaceName); } else { final List ipAddresses = Collections.list(ni.getInetAddresses()).stream().map(inetAddress -> inetAddress.getHostAddress().toLowerCase()).collect(Collectors.toList()); logger.debug("Resolved the following IP addresses for network interface {}: {}", networkInterfaceName, StringUtils.join(ipAddresses, ", ")); allIPAddresses.addAll(ipAddresses); } } catch (SocketException e) { - logger.warn("Cannot resolve network interface named " + networkInterfaceName); + logger.warn("Cannot resolve network interface named {}", networkInterfaceName); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java index 9d0cacf95e..d025bc24c0 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-jetty/src/main/java/org/apache/nifi/web/server/JettyServer.java @@ -613,7 +613,7 @@ public class JettyServer implements NiFiServer, ExtensionUiLoader { logger.info("Loading Docs [{}] Context Path [{}]", docsDir.getAbsolutePath(), docsContext.getContextPath()); } catch (Exception ex) { - logger.error("Unhandled Exception in createDocsWebApp: " + ex.getMessage()); + logger.error("Unhandled Exception in createDocsWebApp", ex); startUpFailure(ex); } } @@ -638,7 +638,7 @@ public class JettyServer implements NiFiServer, ExtensionUiLoader { try { docsDir = Paths.get(docsDirectory).toRealPath().toFile(); } catch (IOException ex) { - logger.info("Directory '" + docsDirectory + "' is missing. Some documentation will be unavailable."); + logger.info("Directory '{}' is missing. Some documentation will be unavailable.", docsDirectory); docsDir = new File(docsDirectory).getAbsoluteFile(); final boolean made = docsDir.mkdirs(); if (!made) { @@ -666,7 +666,7 @@ public class JettyServer implements NiFiServer, ExtensionUiLoader { if (!webApiDocsDir.exists()) { final boolean made = webApiDocsDir.mkdirs(); if (!made) { - logger.error("Failed to create " + webApiDocsDir.getAbsolutePath()); + logger.error("Failed to create {}", webApiDocsDir.getAbsolutePath()); startUpFailure(new IOException(webApiDocsDir.getAbsolutePath() + " could not be created")); } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java index 6a0c5cde35..715a4b877c 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/StandardNiFiWebConfigurationContext.java @@ -199,10 +199,7 @@ public class StandardNiFiWebConfigurationContext implements NiFiWebConfiguration // record the operations auditService.addActions(actions); } catch (final Throwable t) { - logger.warn("Unable to record actions: " + t.getMessage()); - if (logger.isDebugEnabled()) { - logger.warn(StringUtils.EMPTY, t); - } + logger.warn("Unable to record actions", t); } } } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java index a6d04a165c..db133de8a6 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/VersionsResource.java @@ -628,8 +628,8 @@ public class VersionsResource extends FlowUpdateResource] or LT [<] characters, which are not safe final String escapedDn = rawDn.replaceAll(GT, ESCAPED_GT).replaceAll(LT, ESCAPED_LT); if (!escapedDn.equals(rawDn)) { - logger.warn("The provided DN [" + rawDn + "] contained dangerous characters that were escaped to [" + escapedDn + "]"); + logger.warn("The provided DN [{}] contained dangerous characters that were escaped to [{}]", rawDn, escapedDn); } // Second, check for characters outside US-ASCII. @@ -243,7 +243,7 @@ public class ProxiedEntitiesUtils { return escapedDn; } else { final String encodedDn = base64Encode(escapedDn); - logger.debug("The provided DN [" + rawDn + "] contained non-ASCII characters and was encoded as [" + encodedDn + "]"); + logger.debug("The provided DN [{}] contained non-ASCII characters and was encoded as [{}]", rawDn, encodedDn); return encodedDn; } } @@ -268,13 +268,13 @@ public class ProxiedEntitiesUtils { final String decodedDn; if (isBase64Encoded(sanitizedDn)) { decodedDn = base64Decode(sanitizedDn); - logger.debug("The provided DN [" + sanitizedDn + "] had been encoded, and was reconstituted to the original DN [" + decodedDn + "]"); + logger.debug("The provided DN [{}] had been encoded, and was reconstituted to the original DN [{}]", sanitizedDn, decodedDn); } else { decodedDn = sanitizedDn; } final String unsanitizedDn = decodedDn.replaceAll(ESCAPED_GT, GT).replaceAll(ESCAPED_LT, LT); if (!unsanitizedDn.equals(decodedDn)) { - logger.warn("The provided DN [" + sanitizedDn + "] had been escaped, and was reconstituted to the dangerous DN [" + unsanitizedDn + "]"); + logger.warn("The provided DN [{}] had been escaped, and was reconstituted to the dangerous DN [{}]", sanitizedDn, unsanitizedDn); } return unsanitizedDn; } diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java index 55a7aab387..c985b9aa1f 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/requests/ContentLengthFilter.java @@ -45,7 +45,7 @@ public class ContentLengthFilter implements Filter { public void init() { maxContentLength = MAX_LENGTH_DEFAULT; - logger.debug("Filter initialized without configuration and set max content length: " + formatSize(maxContentLength)); + logger.debug("Filter initialized without configuration and set max content length: {}", formatSize(maxContentLength)); } @Override @@ -56,7 +56,7 @@ public class ContentLengthFilter implements Filter { throw new ServletException("Invalid max request length."); } maxContentLength = length; - logger.debug("Filter initialized and set max content length: " + formatSize(maxContentLength)); + logger.debug("Filter initialized and set max content length: {}", formatSize(maxContentLength)); } @Override diff --git a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java index 20d858744b..a35a6113af 100644 --- a/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java +++ b/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-security/src/main/java/org/apache/nifi/web/security/x509/ocsp/OcspCertificateValidator.java @@ -135,7 +135,7 @@ public class OcspCertificateValidator { return ocspStatus; }); } catch (final Exception e) { - logger.error("Disabling OCSP certificate validation. Unable to load OCSP configuration: " + e, e); + logger.error("Disabling OCSP certificate validation. Unable to load OCSP configuration", e); client = null; } } diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java b/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java index 1307bd6585..64184e98ac 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/MockProvenanceReporter.java @@ -106,10 +106,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { .build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -135,10 +132,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { .build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -182,10 +176,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { events.add(record); } } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -233,10 +224,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { .setTransitUri(transitUri).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -260,10 +248,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ADDINFO).setAlternateIdentifierUri(alternateIdentifierUri).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -277,10 +262,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { events.add(record); return record; } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); return null; } } @@ -321,10 +303,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -358,10 +337,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -375,10 +351,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { eventBuilder.addParentFlowFile(parent); events.add(eventBuilder.build()); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -405,10 +378,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.CONTENT_MODIFIED).setEventDuration(processingMillis).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -425,10 +395,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ATTRIBUTES_MODIFIED).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -455,10 +422,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.ROUTE).setRelationship(relationship).setDetails(details).setEventDuration(processingDuration).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } @@ -475,10 +439,7 @@ public class MockProvenanceReporter implements ProvenanceReporter { final ProvenanceEventRecord record = build(flowFile, ProvenanceEventType.CREATE).setDetails(details).build(); events.add(record); } catch (final Exception e) { - logger.error("Failed to generate Provenance Event due to " + e); - if (logger.isDebugEnabled()) { - logger.error("", e); - } + logger.error("Failed to generate Provenance Event", e); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java index f64553f9cc..dd9454b2f1 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-bootstrap/src/main/java/org/apache/nifi/registry/bootstrap/RunNiFiRegistry.java @@ -555,7 +555,7 @@ public class RunNiFiRegistry { final Properties sysProps = (Properties) getSystemPropertiesMethod.invoke(virtualMachine); for (Entry syspropEntry : sysProps.entrySet()) { - logger.info(syspropEntry.getKey().toString() + " = " + syspropEntry.getValue().toString()); + logger.info("{} = {}", syspropEntry.getKey(), syspropEntry.getValue()); } } catch (Throwable t) { throw new RuntimeException(t); @@ -781,7 +781,7 @@ public class RunNiFiRegistry { public void start() throws IOException { final Integer port = getCurrentPort(cmdLogger); if (port != null) { - cmdLogger.info("Apache NiFi Registry is already running, listening to Bootstrap on port " + port); + cmdLogger.info("Apache NiFi Registry is already running, listening to Bootstrap on port {}", port); return; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java index b2daf2db77..c629b428f9 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/db/DatabaseKeyService.java @@ -69,7 +69,7 @@ public class DatabaseKeyService implements KeyService { if (keyEntity != null) { key = KeyMappings.map(keyEntity); } else { - logger.debug("No signing key found with id='" + id + "'"); + logger.debug("No signing key found with id='{}'", id); } } finally { readLock.unlock(); @@ -96,7 +96,7 @@ public class DatabaseKeyService implements KeyService { } if (existingKeyEntity == null) { - logger.debug("No key found with identity='" + tenantIdentity + "'. Creating new key."); + logger.debug("No key found with identity='{}'. Creating new key.", tenantIdentity); final KeyEntity newKeyEntity = new KeyEntity(); newKeyEntity.setId(UUID.randomUUID().toString()); @@ -124,7 +124,7 @@ public class DatabaseKeyService implements KeyService { writeLock.lock(); try { - logger.debug("Deleting key with identity='" + tenantIdentity + "'."); + logger.debug("Deleting key with identity='{}'.", tenantIdentity); final String deleteSql = "DELETE FROM SIGNING_KEY WHERE tenant_identity = ?"; jdbcTemplate.update(deleteSql, tenantIdentity); } finally { diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/EventService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/EventService.java index a521f97fba..1fef404720 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/EventService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/event/EventService.java @@ -108,7 +108,7 @@ public class EventService implements DisposableBean { LOGGER.error("Unable to queue event because queue is full"); } } catch (IllegalStateException e) { - LOGGER.error("Invalid event due to: " + e.getMessage(), e); + LOGGER.error("Invalid event", e); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/extension/ExtensionManager.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/extension/ExtensionManager.java index 8d546e1a60..9a5d8fe803 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/extension/ExtensionManager.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/extension/ExtensionManager.java @@ -158,12 +158,12 @@ public class ExtensionManager { final File dirFile = new File(dir); if (!dirFile.exists()) { - LOGGER.warn("Skipping extension directory that does not exist: " + dir); + LOGGER.warn("Skipping extension directory that does not exist: {}", dir); return null; } if (!dirFile.canRead()) { - LOGGER.warn("Skipping extension directory that can not be read: " + dir); + LOGGER.warn("Skipping extension directory that can not be read: {}", dir); return null; } @@ -180,7 +180,7 @@ public class ExtensionManager { if (files != null) { for (final File resource : files) { if (resource.isDirectory()) { - LOGGER.warn("Recursive directories are not supported, skipping " + resource.getAbsolutePath()); + LOGGER.warn("Recursive directories are not supported, skipping {}", resource.getAbsolutePath()); } else { try { resources.add(resource.toURI().toURL()); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/FileSystemBundlePersistenceProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/FileSystemBundlePersistenceProvider.java index 265f10ba12..819fe85dd3 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/FileSystemBundlePersistenceProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/extension/FileSystemBundlePersistenceProvider.java @@ -180,7 +180,7 @@ public class FileSystemBundlePersistenceProvider implements BundlePersistencePro // delete the directory for the bundle final boolean bundleDirDeleted = bundleDir.delete(); if (!bundleDirDeleted) { - LOGGER.error("Unable to delete extension bundle directory: " + bundleDir.getAbsolutePath()); + LOGGER.error("Unable to delete extension bundle directory: {}", bundleDir.getAbsolutePath()); } // delete the directory for the group and bucket if there is nothing left @@ -189,14 +189,14 @@ public class FileSystemBundlePersistenceProvider implements BundlePersistencePro if (groupFiles.length == 0) { final boolean deletedGroup = groupDir.delete(); if (!deletedGroup) { - LOGGER.error("Unable to delete group directory: " + groupDir.getAbsolutePath()); + LOGGER.error("Unable to delete group directory: {}", groupDir.getAbsolutePath()); } else { final File bucketDir = groupDir.getParentFile(); final File[] bucketFiles = bucketDir.listFiles(); if (bucketFiles.length == 0) { final boolean deletedBucket = bucketDir.delete(); if (!deletedBucket) { - LOGGER.error("Unable to delete bucket directory: " + bucketDir.getAbsolutePath()); + LOGGER.error("Unable to delete bucket directory: {}", bucketDir.getAbsolutePath()); } } } @@ -254,7 +254,7 @@ public class FileSystemBundlePersistenceProvider implements BundlePersistencePro case MINIFI_CPP: return CPP_EXTENSION; default: - LOGGER.warn("Unknown bundle type: " + bundleType); + LOGGER.warn("Unknown bundle type: {}", bundleType); return ""; } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/FileSystemFlowPersistenceProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/FileSystemFlowPersistenceProvider.java index ce7827488e..c8adfe8fb7 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/FileSystemFlowPersistenceProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/FileSystemFlowPersistenceProvider.java @@ -157,7 +157,7 @@ public class FileSystemFlowPersistenceProvider implements FlowPersistenceProvide // delete the directory for the flow final boolean flowDirDeleted = flowDir.delete(); if (!flowDirDeleted) { - LOGGER.error("Unable to delete flow directory: " + flowDir.getAbsolutePath()); + LOGGER.error("Unable to delete flow directory: {}", flowDir.getAbsolutePath()); } // delete the directory for the bucket if there is nothing left 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 ede1d94858..8b90263e45 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 @@ -252,7 +252,7 @@ class GitFlowMetaData { if (bucketObjectIds.isEmpty()) { // No bucket.yml means at this point, all flows are deleted. No need to scan older commits because those are already deleted. - logger.debug("Tree at commit {} does not contain any " + BUCKET_FILENAME + ". Stop loading commits here.", shortCommitId); + logger.debug("Tree at commit {} does not contain any {}. Stop loading commits here.", shortCommitId, BUCKET_FILENAME); return; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java index 5194cc0638..e8d55071e4 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/hook/ScriptEventHookProvider.java @@ -58,7 +58,7 @@ public class ScriptEventHookProvider final String commandString = StringUtils.join(command, " "); final ProcessBuilder builder = new ProcessBuilder(command); builder.directory(workDirFile); - LOGGER.debug("Execution of " + commandString); + LOGGER.debug("Execution of {}", commandString); try { builder.start(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AbstractConfigurableAccessPolicyProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AbstractConfigurableAccessPolicyProvider.java index beb3f954bd..fb545ff387 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AbstractConfigurableAccessPolicyProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/AbstractConfigurableAccessPolicyProvider.java @@ -32,10 +32,10 @@ public abstract class AbstractConfigurableAccessPolicyProvider implements Config @Override public final void initialize(final AccessPolicyProviderInitializationContext initializationContext) throws SecurityProviderCreationException { - LOGGER.debug("Initializing " + getClass().getCanonicalName()); + LOGGER.debug("Initializing {}", getClass().getCanonicalName()); userGroupProviderLookup = initializationContext.getUserGroupProviderLookup(); doInitialize(initializationContext); - LOGGER.debug("Done initializing " + getClass().getCanonicalName()); + LOGGER.debug("Done initializing {}", getClass().getCanonicalName()); } /** @@ -49,7 +49,7 @@ public abstract class AbstractConfigurableAccessPolicyProvider implements Config @Override public final void onConfigured(final AuthorizerConfigurationContext configurationContext) throws SecurityProviderCreationException { try { - LOGGER.debug("Configuring " + getClass().getCanonicalName()); + LOGGER.debug("Configuring {}", getClass().getCanonicalName()); final PropertyValue userGroupProviderIdentifier = configurationContext.getProperty(PROP_USER_GROUP_PROVIDER); if (!userGroupProviderIdentifier.isSet()) { @@ -63,7 +63,7 @@ public abstract class AbstractConfigurableAccessPolicyProvider implements Config doOnConfigured(configurationContext); - LOGGER.debug("Done configuring " + getClass().getCanonicalName()); + LOGGER.debug("Done configuring {}", getClass().getCanonicalName()); } catch (Exception e) { throw new SecurityProviderCreationException(e); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java index 2344c2dc83..6439f4112e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/database/DatabaseAccessPolicyProvider.java @@ -86,7 +86,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli final String nifiGroupName = AccessPolicyProviderUtils.getNiFiGroupName(configurationContext, identityMapper); if (!StringUtils.isBlank(initialAdminIdentity)) { - LOGGER.info("Populating authorizations for Initial Admin: '" + initialAdminIdentity + "'"); + LOGGER.info("Populating authorizations for Initial Admin: '{}'", initialAdminIdentity); populateInitialAdmin(initialAdminIdentity); } @@ -96,7 +96,7 @@ public class DatabaseAccessPolicyProvider extends AbstractConfigurableAccessPoli } if (!StringUtils.isBlank(nifiGroupName)) { - LOGGER.info("Populating authorizations for NiFi Group: '" + nifiGroupName + "'"); + LOGGER.info("Populating authorizations for NiFi Group: '{}'", nifiGroupName); populateNiFiGroup(nifiGroupName); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/file/FileAccessPolicyProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/file/FileAccessPolicyProvider.java index 2e91efedb5..e0c3dbc019 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/file/FileAccessPolicyProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/file/FileAccessPolicyProvider.java @@ -432,7 +432,7 @@ public class FileAccessPolicyProvider extends AbstractConfigurableAccessPolicyPr // if we are starting fresh then we might need to populate an initial admin if (emptyAuthorizations) { if (hasInitialAdminIdentity) { - logger.info("Populating authorizations for Initial Admin: '" + initialAdminIdentity + "'"); + logger.info("Populating authorizations for Initial Admin: '{}'", initialAdminIdentity); populateInitialAdmin(authorizations); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellRunner.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellRunner.java index 1408d27c71..8ad5b9ceb6 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellRunner.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellRunner.java @@ -72,7 +72,7 @@ public class ShellRunner { int lineCount = 0; while ((line = reader.readLine()) != null) { if (logger.isTraceEnabled()) { - logger.trace((++lineCount) + " - " + line); + logger.trace("{} - {}", (++lineCount), line); } lines.add(line.trim()); } @@ -96,7 +96,7 @@ public class ShellRunner { try { proc.destroyForcibly(); } catch (Exception e) { - logger.debug("Process failed to destroy: " + e.getMessage(), e); + logger.debug("Process failed to destroy", e); } throw new IllegalStateException("Shell command '" + command + "' did not complete during the allotted time period"); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellUserGroupProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellUserGroupProvider.java index 4acbe192b6..13f32f516c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellUserGroupProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/authorization/shell/ShellUserGroupProvider.java @@ -92,7 +92,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { @Override public Set getUsers() throws AuthorizationAccessException { synchronized (usersById) { - logger.debug("getUsers has user set of size: " + usersById.size()); + logger.debug("getUsers has user set of size: {}", usersById.size()); return new HashSet<>(usersById.values()); } } @@ -113,9 +113,9 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (user == null) { - logger.debug("getUser (by id) user not found: " + identifier); + logger.debug("getUser (by id) user not found: {}", identifier); } else { - logger.debug("getUser (by id) found user: " + user + " for id: " + identifier); + logger.debug("getUser (by id) found user: {} for id: {}", user, identifier); } return user; } @@ -136,9 +136,9 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (user == null) { - logger.debug("getUser (by name) user not found: " + identity); + logger.debug("getUser (by name) user not found: {}", identity); } else { - logger.debug("getUser (by name) found user: " + user.getIdentity() + " for name: " + identity); + logger.debug("getUser (by name) found user: {} for name: {}", user.getIdentity(), identity); } return user; } @@ -152,7 +152,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { @Override public Set getGroups() throws AuthorizationAccessException { synchronized (groupsById) { - logger.debug("getGroups has group set of size: " + groupsById.size()); + logger.debug("getGroups has group set of size: {}", groupsById.size()); return new HashSet<>(groupsById.values()); } } @@ -173,9 +173,9 @@ public class ShellUserGroupProvider implements UserGroupProvider { } if (group == null) { - logger.debug("getGroup (by id) group not found: " + identifier); + logger.debug("getGroup (by id) group not found: {}", identifier); } else { - logger.debug("getGroup (by id) found group: " + group.getName() + " for id: " + identifier); + logger.debug("getGroup (by id) found group: {} for id: {}", group.getName(), identifier); } return group; @@ -257,7 +257,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { try { shellRunner.runShell(commands.getSystemCheck(), "Supported System Check"); } catch (final Exception e) { - logger.error("initialize exception: " + e + " system check command: " + commands.getSystemCheck()); + logger.error("initialize exception: system check command: {}", commands.getSystemCheck(), e); throw new SecurityProviderCreationException(SYS_CHECK_ERROR, e); } @@ -368,12 +368,12 @@ public class ShellUserGroupProvider implements UserGroupProvider { try { scheduler.shutdownNow(); } catch (final Exception e) { - logger.warn("Error shutting down refresh scheduler: " + e.getMessage(), e); + logger.warn("Error shutting down refresh scheduler", e); } try { shellRunner.shutdown(); } catch (final Exception e) { - logger.warn("Error shutting down ShellRunner: " + e.getMessage(), e); + logger.warn("Error shutting down ShellRunner", e); } } @@ -405,7 +405,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { userLines = shellRunner.runShell(selectedShellCommands.getUsersList(), "Get Users List"); groupLines = shellRunner.runShell(selectedShellCommands.getGroupsList(), "Get Groups List"); } catch (final IOException ioexc) { - logger.error("refreshUsersAndGroups shell exception: " + ioexc); + logger.error("refreshUsersAndGroups shell exception", ioexc); return; } @@ -421,26 +421,26 @@ public class ShellUserGroupProvider implements UserGroupProvider { logger.trace("=== Users by id..."); Set sortedUsers = new TreeSet<>(Comparator.comparing(User::getIdentity)); sortedUsers.addAll(usersById.values()); - sortedUsers.forEach(u -> logger.trace("=== " + u.toString())); + sortedUsers.forEach(u -> logger.trace("=== {}", u)); } } synchronized (usersByName) { usersByName.clear(); usersByName.putAll(usernameToUser); - logger.debug("users now size: " + usersByName.size()); + logger.debug("users now size: {}", usersByName.size()); } synchronized (groupsById) { groupsById.clear(); groupsById.putAll(gidToGroup); - logger.debug("groups now size: " + groupsById.size()); + logger.debug("groups now size: {}", groupsById.size()); if (logger.isTraceEnabled()) { logger.trace("=== Groups by id..."); Set sortedGroups = new TreeSet<>(Comparator.comparing(Group::getName)); sortedGroups.addAll(groupsById.values()); - sortedGroups.forEach(g -> logger.trace("=== " + g.toString())); + sortedGroups.forEach(g -> logger.trace("=== {}", g)); } } @@ -481,11 +481,11 @@ public class ShellUserGroupProvider implements UserGroupProvider { gidToUser.put(group.getIdentifier(), user); logger.debug("Associated primary group {} with user {}", group.getIdentifier(), userIdentity); } else { - logger.warn("Null or empty primary group id for: " + userIdentity); + logger.warn("Null or empty primary group id for: {}", userIdentity); } } else { - logger.warn("Null, empty, or skipped user name: " + userIdentity + " or id: " + userIdentifier); + logger.warn("Null, empty, or skipped user name: {} or id: {}", userIdentity, userIdentifier); } } else { logger.warn("Unexpected record format. Expected 3 or more colon separated values per line."); @@ -541,7 +541,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { } } catch (final IOException ioexc) { - logger.error("list membership shell exception: " + ioexc); + logger.error("list membership shell exception", ioexc); } if (!StringUtils.isBlank(groupIdentifier) && !StringUtils.isBlank(groupName) && !excludeGroups.matcher(groupName).matches()) { @@ -553,7 +553,7 @@ public class ShellUserGroupProvider implements UserGroupProvider { groupsById.put(group.getIdentifier(), group); logger.debug("Refreshed group {}", group); } else { - logger.warn("Null, empty, or skipped group name: " + groupName + " or id: " + groupIdentifier); + logger.warn("Null, empty, or skipped group name: {} or id: {}", groupName, groupIdentifier); } } else { logger.warn("Unexpected record format. Expected 1 or more comma separated values."); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/ldap/tenants/LdapUserGroupProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/ldap/tenants/LdapUserGroupProvider.java index 352bcf9bf2..09f22681e9 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/ldap/tenants/LdapUserGroupProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/ldap/tenants/LdapUserGroupProvider.java @@ -665,10 +665,10 @@ public class LdapUserGroupProvider implements UserGroupProvider { if (logger.isDebugEnabled()) { logger.debug("-------------------------------------"); logger.debug("Loaded the following users from LDAP:"); - userList.forEach((user) -> logger.debug(" - " + user)); + userList.forEach((user) -> logger.debug(" - {}", user)); logger.debug("--------------------------------------"); logger.debug("Loaded the following groups from LDAP:"); - groupList.forEach((group) -> logger.debug(" - " + group)); + groupList.forEach((group) -> logger.debug(" - {}", group)); logger.debug("--------------------------------------"); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/util/ClassLoaderUtils.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/util/ClassLoaderUtils.java index 96e40b331f..520d0a852e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/util/ClassLoaderUtils.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/security/util/ClassLoaderUtils.java @@ -111,7 +111,7 @@ public class ClassLoaderUtils { if (files != null) { for (File classpathResource : files) { if (classpathResource.isDirectory()) { - LOGGER.warn("Recursive directories are not supported, skipping " + classpathResource.getAbsolutePath()); + LOGGER.warn("Recursive directories are not supported, skipping {}", classpathResource.getAbsolutePath()); } else { additionalClasspath.add(classpathResource.toURI().toURL()); } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java index 6ace59caa9..7f886bbc2d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/service/RegistryService.java @@ -313,7 +313,7 @@ public class RegistryService { final BundleEntity bundleEntity = (BundleEntity) itemEntity; bucketItems.add(ExtensionMappings.map(null, bundleEntity)); } else { - LOGGER.error("Unknown type of BucketItemEntity: " + itemEntity.getClass().getCanonicalName()); + LOGGER.error("Unknown type of BucketItemEntity: {}", itemEntity.getClass().getCanonicalName()); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-properties-loader/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryPropertiesLoader.java b/nifi-registry/nifi-registry-core/nifi-registry-properties-loader/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryPropertiesLoader.java index 1fdaf9862e..f159ebac0e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-properties-loader/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryPropertiesLoader.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-properties-loader/src/main/java/org/apache/nifi/registry/properties/NiFiRegistryPropertiesLoader.java @@ -107,7 +107,7 @@ public class NiFiRegistryPropertiesLoader { logger.info("Loaded {} properties from {}", rawProperties.size(), file.getAbsolutePath()); return new ProtectedNiFiRegistryProperties(innerProperties); } catch (final IOException ioe) { - logger.error("Cannot load properties file due to " + ioe.getLocalizedMessage()); + logger.error("Cannot load properties file", ioe); throw new RuntimeException("Cannot load properties file due to " + ioe.getLocalizedMessage(), ioe); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/BootstrapListener.java b/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/BootstrapListener.java index b7189f8c04..d6a1f8883f 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/BootstrapListener.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/BootstrapListener.java @@ -107,7 +107,7 @@ public class BootstrapListener { commandBuilder.append("\n"); final String commandWithArgs = commandBuilder.toString(); - logger.debug("Sending command to Bootstrap: " + commandWithArgs); + logger.debug("Sending command to Bootstrap: {}", commandWithArgs); final OutputStream out = socket.getOutputStream(); out.write((commandWithArgs).getBytes(StandardCharsets.UTF_8)); @@ -197,18 +197,18 @@ public class BootstrapListener { break; } } catch (final Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t.toString(), t); + logger.error("Failed to process request from Bootstrap", t); } finally { try { socket.close(); } catch (final IOException ioe) { - logger.warn("Failed to close socket to Bootstrap due to {}", ioe.toString()); + logger.warn("Failed to close socket to Bootstrap", ioe); } } } }); } catch (final Throwable t) { - logger.error("Failed to process request from Bootstrap due to " + t.toString(), t); + logger.error("Failed to process request from Bootstrap", t); } } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java b/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java index 601fc49572..a9e3f4c339 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-runtime/src/main/java/org/apache/nifi/registry/NiFiRegistry.java @@ -132,7 +132,7 @@ public class NiFiRegistry { } LOGGER.info("Jetty web server shutdown completed (nicely or otherwise)."); } catch (final Throwable t) { - LOGGER.warn("Problem occurred ensuring Jetty web server was properly terminated due to " + t); + LOGGER.warn("Problem occurred ensuring Jetty web server was properly terminated", t); } } @@ -158,7 +158,7 @@ public class NiFiRegistry { try { new NiFiRegistry(properties, masterKeyProvider); } catch (final Throwable t) { - LOGGER.error("Failure to launch NiFi Registry due to " + t, t); + LOGGER.error("Failure to launch NiFi Registry", t); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-security-utils/src/main/java/org/apache/nifi/registry/security/util/ProxiedEntitiesUtils.java b/nifi-registry/nifi-registry-core/nifi-registry-security-utils/src/main/java/org/apache/nifi/registry/security/util/ProxiedEntitiesUtils.java index 45a11f47e4..f461f8f0c8 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-security-utils/src/main/java/org/apache/nifi/registry/security/util/ProxiedEntitiesUtils.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-security-utils/src/main/java/org/apache/nifi/registry/security/util/ProxiedEntitiesUtils.java @@ -135,7 +135,7 @@ public class ProxiedEntitiesUtils { // First, escape any GT [>] or LT [<] characters, which are not safe final String escapedDn = rawDn.replaceAll(GT, ESCAPED_GT).replaceAll(LT, ESCAPED_LT); if (!escapedDn.equals(rawDn)) { - logger.warn("The provided DN [" + rawDn + "] contained dangerous characters that were escaped to [" + escapedDn + "]"); + logger.warn("The provided DN [{}] contained dangerous characters that were escaped to [{}]", rawDn, escapedDn); } // Second, check for characters outside US-ASCII. @@ -154,7 +154,7 @@ public class ProxiedEntitiesUtils { return escapedDn; } else { final String encodedDn = base64Encode(escapedDn); - logger.debug("The provided DN [" + rawDn + "] contained non-ASCII characters and was encoded as [" + encodedDn + "]"); + logger.debug("The provided DN [{}] contained non-ASCII characters and was encoded as [{}]", rawDn, encodedDn); return encodedDn; } } @@ -179,13 +179,13 @@ public class ProxiedEntitiesUtils { final String decodedDn; if (isBase64Encoded(sanitizedDn)) { decodedDn = base64Decode(sanitizedDn); - logger.debug("The provided DN [" + sanitizedDn + "] had been encoded, and was reconstituted to the original DN [" + decodedDn + "]"); + logger.debug("The provided DN [{}] had been encoded, and was reconstituted to the original DN [{}]", sanitizedDn, decodedDn); } else { decodedDn = sanitizedDn; } final String unsanitizedDn = decodedDn.replaceAll(ESCAPED_GT, GT).replaceAll(ESCAPED_LT, LT); if (!unsanitizedDn.equals(decodedDn)) { - logger.warn("The provided DN [" + sanitizedDn + "] had been escaped, and was reconstituted to the dangerous DN [" + unsanitizedDn + "]"); + logger.warn("The provided DN [{}] had been escaped, and was reconstituted to the dangerous DN [{}]", sanitizedDn, unsanitizedDn); } return unsanitizedDn; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-utils/src/main/java/org/apache/nifi/registry/util/FileUtils.java b/nifi-registry/nifi-registry-core/nifi-registry-utils/src/main/java/org/apache/nifi/registry/util/FileUtils.java index 939c9b7893..eaeb2c6ca6 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-utils/src/main/java/org/apache/nifi/registry/util/FileUtils.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-utils/src/main/java/org/apache/nifi/registry/util/FileUtils.java @@ -161,7 +161,7 @@ public class FileUtils { FileUtils.deleteFile(destination, null, 5); throw new IOException("Could not remove file " + source.getAbsolutePath()); } else { - logger.warn("Configured to delete source file when renaming/move not successful. However, unable to delete file at: " + source.getAbsolutePath()); + logger.warn("Configured to delete source file when renaming/move not successful. However, unable to delete file at: {}", source.getAbsolutePath()); } } } finally { @@ -270,12 +270,12 @@ public class FileUtils { } } if (!isGone && logger != null) { - logger.warn("File appears to exist but unable to delete file: " + file.getAbsolutePath()); + logger.warn("File appears to exist but unable to delete file: {}", file.getAbsolutePath()); } } } catch (final Throwable t) { if (logger != null) { - logger.warn("Unable to delete file: '" + file.getAbsolutePath() + "' due to " + t); + logger.warn("Unable to delete file: '{}'", file.getAbsolutePath(), t); } } return isGone; diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java index 8843816578..158c90dee5 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/AccessResource.java @@ -273,8 +273,8 @@ public class AccessResource extends ApplicationResource { throw new IllegalStateException("Username/Password login not supported by this NiFi. Contact System Administrator."); } if (!(identityProvider instanceof BasicAuthIdentityProvider)) { - logger.debug("An Identity Provider is configured, but it does not support HTTP Basic Auth authentication. " + - "The configured Identity Provider must extend {}", BasicAuthIdentityProvider.class); + logger.debug("An Identity Provider is configured, but it does not support HTTP Basic Auth authentication. The configured Identity Provider must extend {}", + BasicAuthIdentityProvider.class); throw new IllegalStateException("Username/Password login not supported by this NiFi. Contact System Administrator."); } @@ -323,11 +323,11 @@ public class AccessResource extends ApplicationResource { if (userIdentity != null && !userIdentity.isEmpty()) { try { - logger.info("Logging out user " + userIdentity); + logger.info("Logging out user {}", userIdentity); jwtService.deleteKey(userIdentity); return generateOkResponse().build(); } catch (final JwtException e) { - logger.error("Logout of user " + userIdentity + " failed due to: " + e.getMessage()); + logger.error("Logout of user {} failed", userIdentity, e); return Response.serverError().build(); } } else { @@ -633,7 +633,7 @@ public class AccessResource extends ApplicationResource { final AuthorizationGrant authorizationGrant = new AuthorizationCodeGrant(authorizationCode, URI.create(getOidcCallback())); oidcService.exchangeAuthorizationCodeForLoginAuthenticationToken(oidcRequestIdentifier, authorizationGrant); } catch (final Exception e) { - logger.error("Unable to exchange authorization for ID token: " + e.getMessage(), e); + logger.error("Unable to exchange authorization for ID token", e); // remove the oidc request cookie removeOidcRequestCookie(httpServletResponse); @@ -1042,8 +1042,7 @@ public class AccessResource extends ApplicationResource { final String postLogoutRedirectUri = getNiFiRegistryUri(); httpServletResponse.sendRedirect(postLogoutRedirectUri); } else { - logger.error("There was an error logging out of the OpenId Connect Provider. " + - "Response status: " + response.getStatusLine().getStatusCode()); + logger.error("There was an error logging out of the OpenId Connect Provider. Response status: {}", response.getStatusLine().getStatusCode()); } } finally { httpClient.close(); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java index 0dc4dba44d..51c5f8fc9c 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/api/ApplicationResource.java @@ -77,7 +77,7 @@ public class ApplicationResource { try { eventService.publish(event); } catch (Throwable t) { - logger.error("Unable to publish event: " + t.getMessage(), t); + logger.error("Unable to publish event", t); } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistryMasterKeyProviderFactory.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistryMasterKeyProviderFactory.java index f4fc50d2c2..feb439f8a0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistryMasterKeyProviderFactory.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/NiFiRegistryMasterKeyProviderFactory.java @@ -43,20 +43,15 @@ public class NiFiRegistryMasterKeyProviderFactory implements ServletContextAware Object rawKeyProviderObject = servletContext.getAttribute(NiFiRegistryApiApplication.NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE); if (rawKeyProviderObject == null) { - logger.warn("Value of {} was null. " + - "{} bean will not be available in Application Context, so any attempt to load protected property values may fail.", - NiFiRegistryApiApplication.NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE, - CryptoKeyProvider.class.getSimpleName()); + logger.warn("Value of {} was null. {} bean will not be available in Application Context, so any attempt to load protected property values may fail.", + NiFiRegistryApiApplication.NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE, CryptoKeyProvider.class.getSimpleName()); return; } if (!(rawKeyProviderObject instanceof CryptoKeyProvider)) { - logger.warn("Expected value of {} to be of type {}, but instead got {}. " + - "{} bean will NOT be available in Application Context, so any attempt to load protected property values may fail.", - NiFiRegistryApiApplication.NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE, - CryptoKeyProvider.class.getName(), - rawKeyProviderObject.getClass().getName(), - CryptoKeyProvider.class.getSimpleName()); + logger.warn("Expected value of {} to be of type {}, but instead got {}. {} bean will NOT be available in Application Context, so any attempt to load protected property values may fail.", + NiFiRegistryApiApplication.NIFI_REGISTRY_MASTER_KEY_ATTRIBUTE, CryptoKeyProvider.class.getName(), + rawKeyProviderObject.getClass().getName(), CryptoKeyProvider.class.getSimpleName()); return; } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java index 2daf267aca..afaa9c6526 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/jwt/JwtService.java @@ -76,7 +76,6 @@ public class JwtService { } return jws.getPayload().getSubject(); } catch (JwtException e) { - logger.debug("The Base64 encoded JWT: " + base64EncodedToken); final String errorMessage = "There was an error validating the JWT"; logger.error(errorMessage, e); throw e; @@ -149,8 +148,6 @@ public class JwtService { final Key key = keyService.getOrCreateKey(identity); final byte[] keyBytes = key.getKey().getBytes(StandardCharsets.UTF_8); - //logger.trace("Generating JWT for " + describe(authenticationResponse)); - // TODO: Implement "jti" claim with nonce to prevent replay attacks and allow blacklisting of revoked tokens // Build the token return Jwts.builder().subject(identity) @@ -178,7 +175,7 @@ public class JwtService { keyService.deleteKey(userIdentity); logger.info("Deleted token from database."); } catch (Exception e) { - logger.error("Unable to delete token for user: [" + userIdentity + "]."); + logger.error("Unable to delete token for user: [{}].", userIdentity); throw e; } } diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosIdentityProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosIdentityProvider.java index ee55c02b17..d5c5012fd0 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosIdentityProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/kerberos/KerberosIdentityProvider.java @@ -57,7 +57,7 @@ public class KerberosIdentityProvider extends BasicAuthIdentityProvider { String rawExpiration = configurationContext.getProperty("Authentication Expiration"); if (StringUtils.isBlank(rawExpiration)) { rawExpiration = default_expiration; - logger.info("No Authentication Expiration specified, defaulting to " + default_expiration); + logger.info("No Authentication Expiration specified, defaulting to {}", default_expiration); } try { @@ -115,16 +115,13 @@ public class KerberosIdentityProvider extends BasicAuthIdentityProvider { final UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(identity, credentials); if (logger.isDebugEnabled()) { - logger.debug("Created authentication token " + token.toString()); + logger.debug("Created authentication token {}", token); } final Authentication authentication = provider.authenticate(token); if (logger.isDebugEnabled()) { - logger.debug("Ran provider.authenticate(token) and returned authentication for " + - "principal={} with name={} and isAuthenticated={}", - authentication.getPrincipal(), - authentication.getName(), - authentication.isAuthenticated()); + logger.debug("Ran provider.authenticate(token) and returned authentication for principal={} with name={} and isAuthenticated={}", + authentication.getPrincipal(), authentication.getName(), authentication.isAuthenticated()); } return new AuthenticationResponse(authentication.getName(), identity, expiration, issuer); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/StandardOidcIdentityProvider.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/StandardOidcIdentityProvider.java index e70f696604..1726f23b37 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/StandardOidcIdentityProvider.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/main/java/org/apache/nifi/registry/web/security/authentication/oidc/StandardOidcIdentityProvider.java @@ -405,8 +405,7 @@ public class StandardOidcIdentityProvider implements OidcIdentityProvider { if (StringUtils.isBlank(identity)) { // Provide clear message to admin that desired claim is missing and present available claims List availableClaims = getAvailableClaims(oidcJwt.getJWTClaimsSet()); - logger.warn("Failed to obtain the identity of the user with the claim '{}'. The available claims on " + - "the OIDC response are: {}. Will attempt to obtain the identity from secondary sources", + logger.warn("Failed to obtain the identity of the user with the claim '{}'. The available claims on the OIDC response are: {}. Will attempt to obtain the identity from secondary sources", identityClaim, availableClaims); // If the desired user claim was not "email" and "email" is present, use that diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/DBFlowStorageIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/DBFlowStorageIT.java index 29337b225b..3c2dfad653 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/DBFlowStorageIT.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/DBFlowStorageIT.java @@ -58,7 +58,7 @@ public class DBFlowStorageIT extends IntegrationTestBase { @BeforeEach public void setup() throws IOException { final String baseUrl = createBaseURL(); - LOGGER.info("Using base url = " + baseUrl); + LOGGER.info("Using base url = {}", baseUrl); final NiFiRegistryClientConfig clientConfig = new NiFiRegistryClientConfig.Builder() .baseUrl(baseUrl) diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java index c51995a131..430f0a5e7e 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureNiFiRegistryClientIT.java @@ -71,7 +71,7 @@ public class SecureNiFiRegistryClientIT extends IntegrationTestBase { @BeforeEach public void setup() { final String baseUrl = createBaseURL(); - LOGGER.info("Using base url = " + baseUrl); + LOGGER.info("Using base url = {}", baseUrl); final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl); assertNotNull(clientConfig); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureProxyIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureProxyIT.java index 1a9967fd20..77fad38cd9 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureProxyIT.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/SecureProxyIT.java @@ -63,7 +63,7 @@ public class SecureProxyIT extends IntegrationTestBase { @BeforeEach public void setup() { final String baseUrl = createBaseURL(); - LOGGER.info("Using base url = " + baseUrl); + LOGGER.info("Using base url = {}", baseUrl); final NiFiRegistryClientConfig clientConfig = createClientConfig(baseUrl); assertNotNull(clientConfig); diff --git a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java index 94451b635c..925244b57d 100644 --- a/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java +++ b/nifi-registry/nifi-registry-core/nifi-registry-web-api/src/test/java/org/apache/nifi/registry/web/api/UnsecuredNiFiRegistryClientIT.java @@ -74,7 +74,7 @@ public class UnsecuredNiFiRegistryClientIT extends UnsecuredITBase { @BeforeEach public void setup() { final String baseUrl = createBaseURL(); - LOGGER.info("Using base url = " + baseUrl); + LOGGER.info("Using base url = {}", baseUrl); final NiFiRegistryClientConfig clientConfig = new NiFiRegistryClientConfig.Builder() .baseUrl(baseUrl) @@ -95,7 +95,7 @@ public class UnsecuredNiFiRegistryClientIT extends UnsecuredITBase { try { FileUtils.deleteFile(extensionsStorageDir, true); } catch (Exception e) { - LOGGER.warn("Unable to delete extensions storage dir due to: " + e.getMessage(), e); + LOGGER.warn("Unable to delete extensions storage dir", e); } } } diff --git a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java index 5a51bfb6c7..973f0f41a1 100644 --- a/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java +++ b/nifi-registry/nifi-registry-extensions/nifi-registry-aws/nifi-registry-aws-extensions/src/main/java/org/apache/nifi/registry/aws/S3BundlePersistenceProvider.java @@ -121,8 +121,7 @@ public class S3BundlePersistenceProvider implements BundlePersistenceProvider { } if (region == null) { - LOGGER.warn("The provided region was not found in the list of known regions. This may indicate an invalid region, " + - "or may indicate a region that is newer than the known list of regions"); + LOGGER.warn("The provided region was not found in the list of known regions. This may indicate an invalid region, or may indicate a region that is newer than the known list of regions"); region = Region.of(regionValue); } @@ -319,7 +318,7 @@ public class S3BundlePersistenceProvider implements BundlePersistenceProvider { case MINIFI_CPP: return CPP_EXTENSION; default: - LOGGER.warn("Unknown bundle type: " + bundleType); + LOGGER.warn("Unknown bundle type: {}", bundleType); return ""; } } diff --git a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java index 8edaa3e617..1888b667a4 100644 --- a/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java +++ b/nifi-stateless/nifi-stateless-bootstrap/src/main/java/org/apache/nifi/stateless/bootstrap/StatelessBootstrap.java @@ -227,7 +227,7 @@ public class StatelessBootstrap { for (final File file : files) { if (file.isDirectory()) { - logger.debug(file.getAbsolutePath() + "/"); + logger.debug("{}/", file.getAbsolutePath()); final File[] children = file.listFiles(); if (children == null) { logger.debug("Failed to perform listing of directory {}", file); diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/config/PropertiesFileFlowDefinitionParser.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/config/PropertiesFileFlowDefinitionParser.java index 9221bdbf45..bb0d82980f 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/config/PropertiesFileFlowDefinitionParser.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/config/PropertiesFileFlowDefinitionParser.java @@ -154,7 +154,7 @@ public class PropertiesFileFlowDefinitionParser implements DataflowDefinitionPar if (relativePropertyName.startsWith("properties.")) { if (relativePropertyName.length() < 12) { - logger.warn("Encountered unexpected property <" + propertyName + "> in flow definition. This property will be ignored."); + logger.warn("Encountered unexpected property <{}> in flow definition. This property will be ignored.", propertyName); continue; } @@ -175,7 +175,7 @@ public class PropertiesFileFlowDefinitionParser implements DataflowDefinitionPar definition.setBundleCoordinates(propertyValue); break; default: - logger.warn("Encountered unexpected property <" + propertyName + "> in flow definition. This property will be ignored."); + logger.warn("Encountered unexpected property <{}> in flow definition. This property will be ignored.", propertyName); break; } } @@ -207,7 +207,7 @@ public class PropertiesFileFlowDefinitionParser implements DataflowDefinitionPar if (relativePropertyName.startsWith(PROPERTIES_PREFIX)) { if (relativePropertyName.length() <= PROPERTIES_PREFIX.length()) { - logger.warn("Encountered unexpected property <" + propertyName + "> in flow definition. This property will be ignored."); + logger.warn("Encountered unexpected property <{}> in flow definition. This property will be ignored.", propertyName); continue; } @@ -225,7 +225,7 @@ public class PropertiesFileFlowDefinitionParser implements DataflowDefinitionPar definition.setBundleCoordinates(propertyValue); break; default: - logger.warn("Encountered unexpected property <" + propertyName + "> in flow definition. This property will be ignored."); + logger.warn("Encountered unexpected property <{}> in flow definition. This property will be ignored.", propertyName); break; } } @@ -237,7 +237,7 @@ public class PropertiesFileFlowDefinitionParser implements DataflowDefinitionPar final ParameterValueProviderDefinition definition = entry.getValue(); if (definition.getName() == null) { - logger.warn("Parameter Value Provider identified in Properties with key <" + providerKey + "> was not provided a name. Will default name to <" + providerKey + ">"); + logger.warn("Parameter Value Provider identified in Properties with key <{}> was not provided a name. Will default name to <{}>", providerKey, providerKey); definition.setName(providerKey); } diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java index d3b9cadd24..0da271feff 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/engine/StandardStatelessEngine.java @@ -556,8 +556,8 @@ public class StandardStatelessEngine implements StatelessEngine { final String contextName = parameterContextDefinition.getName(); final ParameterContext existingContext = parameterContextMap.get(contextName); if (existingContext == null) { - logger.warn("Configuration contains a Parameter Context with name <" + contextName + "> but the flow does not contain any Parameter Context with this name. " + - "These Parameters will be ignored."); + logger.warn("Configuration contains a Parameter Context with name <{}> but the flow does not contain any Parameter Context with this name. These Parameters will be ignored.", + contextName); return; } diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessFlowCurrent.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessFlowCurrent.java index d1332ae6b5..6b965786f0 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessFlowCurrent.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/flow/StandardStatelessFlowCurrent.java @@ -248,13 +248,13 @@ public class StandardStatelessFlowCurrent implements StatelessFlowCurrent { // triggering source components final boolean thresholdMet = transactionThresholdMeter.isThresholdMet(); if (thresholdMet) { - logger.debug("{} was triggered but unable to make progress. The transaction thresholds {} have been met (currently at {}). Will not " + - "trigger source components to run.", connectable, transactionThresholdMeter.getThresholds(), transactionThresholdMeter); + logger.debug("{} was triggered but unable to make progress. The transaction thresholds {} have been met (currently at {}). Will not trigger source components to run.", + connectable, transactionThresholdMeter.getThresholds(), transactionThresholdMeter); continue; } - logger.debug("{} was triggered but unable to make progress. Maximum transaction thresholds {} have not been reached (currently at {}) " + - "so will trigger source components to run.", connectable, transactionThresholdMeter.getThresholds(), transactionThresholdMeter); + logger.debug("{} was triggered but unable to make progress. Maximum transaction thresholds {} have not been reached (currently at {}) so will trigger source components to run.", + connectable, transactionThresholdMeter.getThresholds(), transactionThresholdMeter); return NextConnectable.SOURCE_CONNECTABLE; } diff --git a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessFileSystemContentRepository.java b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessFileSystemContentRepository.java index fd5cd9e87f..ddfc9551cd 100644 --- a/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessFileSystemContentRepository.java +++ b/nifi-stateless/nifi-stateless-bundle/nifi-stateless-engine/src/main/java/org/apache/nifi/stateless/repository/StatelessFileSystemContentRepository.java @@ -327,7 +327,7 @@ public class StatelessFileSystemContentRepository implements ContentRepository { for (final ResourceClaim resourceClaim : writableStreamMap.keySet()) { final File file = getFile(resourceClaim); if (!file.delete() && file.exists()) { - logger.warn("Failed to remove file from Content Repository: " + file.getAbsolutePath()); + logger.warn("Failed to remove file from Content Repository: {}", file.getAbsolutePath()); } }