Skip to content

Commit d2abd88

Browse files
authored
cleanup: adapt logs to logging guide (#1650)
1 parent cfc0b4f commit d2abd88

File tree

16 files changed

+31
-41
lines changed

16 files changed

+31
-41
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ in the detailed section referring to by linking pull requests or issues.
6161
* Fix race condition in `ContractNegotiationIntegrationTest` (#1505)
6262
* Fix for change in Cosmos DB behavior on missing sort fields (#1514)
6363
* Effectively removed default LIMIT in SQL Contract Def Store (#1515)
64-
* Added query validation (#1605)
64+
* Add query validation (#1605)
65+
* Adapt logs to the logging guide (#1425)
6566

6667
## [milestone-4] - 2022-06-07
6768

core/contract/src/main/java/org/eclipse/dataspaceconnector/contract/negotiation/AbstractContractNegotiationManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public BiConsumer<Object, Throwable> build() {
211211
negotiation.transitionError("Retry limited exceeded: " + throwable.getMessage());
212212
update(negotiation, l -> l.preError(negotiation));
213213
observable.invokeForEach(l -> l.failed(negotiation));
214-
monitor.warning(format("[%s] attempt #%d failed to %s. Retry limit exceeded, ContractNegotiation %s moves to ERROR state",
214+
monitor.severe(format("[%s] attempt #%d failed to %s. Retry limit exceeded, ContractNegotiation %s moves to ERROR state",
215215
getName(), negotiation.getStateCount(), operationDescription, negotiation.getId()), throwable);
216216
} else {
217217
onFailureHandler.accept(negotiation);

core/transfer/src/main/java/org/eclipse/dataspaceconnector/transfer/core/transfer/TransferProcessManagerImpl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private boolean processInProgress(TransferProcess process) {
358358
var checker = statusCheckerRegistry.resolve(process.getDataRequest().getDestinationType());
359359
if (checker == null) {
360360
if (process.getDataRequest().isManagedResources()) {
361-
monitor.info(format("No checker found for process %s. The process will not advance to the COMPLETED state.", process.getId()));
361+
monitor.warning(format("No checker found for process %s. The process will not advance to the COMPLETED state.", process.getId()));
362362
return false;
363363
} else {
364364
//no checker, transition the process to the COMPLETED state automatically
@@ -372,7 +372,7 @@ private boolean processInProgress(TransferProcess process) {
372372
return true;
373373
} else {
374374
// Process is not finished yet, so it stays in the IN_PROGRESS state
375-
monitor.info(format("Transfer process %s not COMPLETED yet. The process will not advance to the COMPLETED state.", process.getId()));
375+
monitor.debug(format("Transfer process %s not COMPLETED yet. The process will not advance to the COMPLETED state.", process.getId()));
376376
breakLease(process);
377377
return false;
378378
}
@@ -631,13 +631,13 @@ private void sendConsumerRequestSuccess(TransferProcess transferProcess) {
631631

632632
private void sendCustomerRequestFailure(TransferProcess transferProcess, Throwable e) {
633633
if (sendRetryManager.retriesExhausted(transferProcess)) {
634-
monitor.info(format("TransferProcessManager: attempt #%d failed to send transfer. Retry limit exceeded, TransferProcess %s moves to ERROR state.",
634+
monitor.severe(format("TransferProcessManager: attempt #%d failed to send transfer. Retry limit exceeded, TransferProcess %s moves to ERROR state.",
635635
transferProcess.getStateCount(),
636636
transferProcess.getId()), e);
637637
transitionToError(transferProcess.getId(), e, "Retry limit exceeded");
638638
return;
639639
}
640-
monitor.info(format("TransferProcessManager: attempt #%d failed to send transfer. TransferProcess %s stays in state %s.",
640+
monitor.debug(format("TransferProcessManager: attempt #%d failed to send transfer. TransferProcess %s stays in state %s.",
641641
transferProcess.getStateCount(),
642642
transferProcess.getId(),
643643
TransferProcessStates.from(transferProcess.getState())), e);

data-protocols/ids/ids-api-multipart-endpoint-v1/src/main/java/org/eclipse/dataspaceconnector/ids/api/multipart/handler/ArtifactRequestHandler.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,31 +87,31 @@ public boolean canHandle(@NotNull MultipartRequest multipartRequest) {
8787
var artifactUri = artifactRequestMessage.getRequestedArtifact();
8888
var artifactIdsId = IdsIdParser.parse(artifactUri.toString());
8989
if (artifactIdsId.getType() != IdsType.ARTIFACT) {
90-
monitor.info("ArtifactRequestHandler: Requested artifact URI not of type artifact.");
90+
monitor.debug("ArtifactRequestHandler: Requested artifact URI not of type artifact.");
9191
return createBadParametersErrorMultipartResponse(multipartRequest.getHeader());
9292
}
9393

9494
var contractUri = artifactRequestMessage.getTransferContract();
9595
var contractIdsId = IdsIdParser.parse(contractUri.toString());
9696
if (contractIdsId.getType() != IdsType.CONTRACT) {
97-
monitor.info("ArtifactRequestHandler: Requested artifact URI not of type contract.");
97+
monitor.debug("ArtifactRequestHandler: Transfer contract URI not of type contract.");
9898
return createBadParametersErrorMultipartResponse(multipartRequest.getHeader());
9999
}
100100

101101
var contractAgreement = contractNegotiationStore.findContractAgreement(contractIdsId.getValue());
102102
if (contractAgreement == null) {
103-
monitor.info(String.format("ArtifactRequestHandler: No contract agreement with id %s found.", contractIdsId.getValue()));
103+
monitor.debug(String.format("ArtifactRequestHandler: No contract agreement with id %s found.", contractIdsId.getValue()));
104104
return createBadParametersErrorMultipartResponse(multipartRequest.getHeader());
105105
}
106106

107107
var isContractValid = contractValidationService.validate(claimToken, contractAgreement);
108108
if (!isContractValid) {
109-
monitor.info("ArtifactRequestHandler: Contract is invalid");
109+
monitor.debug("ArtifactRequestHandler: Contract is invalid");
110110
return createBadParametersErrorMultipartResponse(multipartRequest.getHeader());
111111
}
112112

113113
if (!artifactIdsId.getValue().equals(contractAgreement.getAssetId())) {
114-
monitor.info(String.format("ArtifactRequestHandler: invalid artifact id specified %s for contract: %s", artifactIdsId.getValue(), contractIdsId.getValue()));
114+
monitor.debug(String.format("ArtifactRequestHandler: invalid artifact id specified %s for contract: %s", artifactIdsId.getValue(), contractIdsId.getValue()));
115115
return createBadParametersErrorMultipartResponse(multipartRequest.getHeader());
116116
}
117117

extensions/aws/s3/s3-provision/src/main/java/org/eclipse/dataspaceconnector/aws/s3/provision/AwsProvisionExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void shutdown() {
9696
try {
9797
clientProvider.shutdown();
9898
} catch (Exception e) {
99-
monitor.info("Error closing S3 client provider", e);
99+
monitor.severe("Error closing S3 client provider", e);
100100
}
101101
}
102102

extensions/azure/blobstorage/blob-provision/src/main/java/org/eclipse/dataspaceconnector/provision/azure/blob/ObjectStorageProvisioner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public CompletableFuture<StatusResult<ProvisionResponse>> provision(ObjectStorag
5858
String containerName = resourceDefinition.getContainerName();
5959
String accountName = resourceDefinition.getAccountName();
6060

61-
monitor.info("Azure Storage Container request submitted: " + containerName);
61+
monitor.debug("Azure Storage Container request submitted: " + containerName);
6262

6363
OffsetDateTime expiryTime = OffsetDateTime.now().plusHours(1);
6464

extensions/azure/cosmos/transfer-process-store-cosmos/src/main/java/org/eclipse/dataspaceconnector/transfer/store/cosmos/CosmosTransferProcessStoreExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void initialize(ServiceExtensionContext context) {
5555

5656
var connectorId = context.getConnectorId();
5757

58-
monitor.info("CosmosTransferProcessStore will use connector id '" + connectorId + "'");
58+
monitor.debug("CosmosTransferProcessStore will use connector id '" + connectorId + "'");
5959
TransferProcessStoreCosmosConfig configuration = new TransferProcessStoreCosmosConfig(context);
6060
var client = clientProvider.createClient(vault, configuration);
6161
var cosmosDbApi = new CosmosDbApiImpl(configuration, client);

extensions/azure/data-plane/data-factory/src/main/java/org/eclipse/dataspaceconnector/azure/dataplane/azuredatafactory/AzureDataFactoryTransferManager.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public CompletableFuture<StatusResult<Void>> transfer(DataFlowRequest request) {
9292

9393
var runId = client.runPipeline(pipeline).runId();
9494

95-
monitor.info("Created ADF pipeline for " + request.getProcessId() + ". Run id is " + runId);
95+
monitor.debug("Created ADF pipeline for " + request.getProcessId() + ". Run id is " + runId);
9696

9797
return awaitRunCompletion(runId)
9898
.thenApply(result -> {
@@ -110,14 +110,14 @@ public CompletableFuture<StatusResult<Void>> transfer(DataFlowRequest request) {
110110

111111
@NotNull
112112
private CompletableFuture<StatusResult<Void>> awaitRunCompletion(String runId) {
113-
monitor.info("Awaiting ADF pipeline completion for run " + runId);
113+
monitor.debug("Awaiting ADF pipeline completion for run " + runId);
114114

115115
var timeout = clock.instant().plus(maxDuration);
116116
while (clock.instant().isBefore(timeout)) {
117117
var pipelineRun = client.getPipelineRun(runId);
118118
var runStatusValue = pipelineRun.status();
119119
var message = pipelineRun.message();
120-
monitor.info("ADF run status is " + runStatusValue + " with message [" + message + "] for run " + runId);
120+
monitor.debug("ADF run status is " + runStatusValue + " with message [" + message + "] for run " + runId);
121121
DataFactoryPipelineRunStates runStatus;
122122

123123
try {

extensions/azure/events/src/main/java/org/eclipse/dataspaceconnector/events/azure/AzureEventExtension.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ public String name() {
4040

4141
@Override
4242
public void initialize(ServiceExtensionContext context) {
43-
monitor.info("AzureEventExtension: create event grid appender");
44-
registerListeners(context);
45-
}
46-
47-
private void registerListeners(ServiceExtensionContext context) {
4843
var config = new AzureEventGridConfig(context);
4944
var topicName = config.getTopic();
5045
var endpoint = config.getEndpoint(topicName);
@@ -56,13 +51,12 @@ private void registerListeners(ServiceExtensionContext context) {
5651
.buildEventGridEventPublisherAsyncClient();
5752

5853

59-
AzureEventGridPublisher publisher = new AzureEventGridPublisher(context.getConnectorId(), monitor, publisherClient);
54+
var publisher = new AzureEventGridPublisher(context.getConnectorId(), monitor, publisherClient);
6055

6156
var processObservable = context.getService(TransferProcessObservable.class, true);
6257
if (processObservable != null) {
6358
processObservable.registerListener(publisher);
6459
}
6560
}
6661

67-
6862
}

extensions/azure/events/src/main/java/org/eclipse/dataspaceconnector/events/azure/AzureEventGridPublisher.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private class LoggingSubscriber<T> extends BaseSubscriber<T> {
9999

100100
@Override
101101
protected void hookOnComplete() {
102-
monitor.info("AzureEventGrid: " + message);
102+
monitor.debug("AzureEventGrid: " + message);
103103
}
104104

105105
@Override

extensions/azure/vault/src/main/java/org/eclipse/dataspaceconnector/core/security/azure/AzureVault.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Result<Void> deleteSecret(String key) {
137137
@NotNull
138138
private String sanitizeKey(String key) {
139139
if (key.contains(".")) {
140-
monitor.info("AzureVault: key contained '.' which is not allowed. replaced with '-'");
140+
monitor.debug("AzureVault: key contained '.' which is not allowed. replaced with '-'");
141141
key = key.replace(".", "-");
142142
}
143143
return key;

extensions/azure/vault/src/main/java/org/eclipse/dataspaceconnector/core/security/azure/AzureVaultExtension.java

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ public void initialize(ServiceExtensionContext context) {
6464
? AzureVault.authenticateWithCertificate(context.getMonitor(), clientId, tenantId, certPath, keyVaultName)
6565
: AzureVault.authenticateWithSecret(context.getMonitor(), clientId, tenantId, clientSecret, keyVaultName);
6666

67-
context.getMonitor().info("AzureVaultExtension: authentication/initialization complete.");
68-
6967
context.registerService(Vault.class, vault);
7068
context.registerService(PrivateKeyResolver.class, new VaultPrivateKeyResolver(vault));
7169
context.registerService(CertificateResolver.class, new AzureCertificateResolver(vault));

extensions/catalog/federated-catalog-cache/src/main/java/org/eclipse/dataspaceconnector/catalog/cache/FederatedCatalogCacheExtension.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ public class FederatedCatalogCacheExtension implements ServiceExtension {
9090
@Inject
9191
private RetryPolicy<Object> retryPolicy;
9292

93+
@Override
94+
public String name() {
95+
return "Federated Catalog Cache";
96+
}
97+
9398
@Override
9499
public void initialize(ServiceExtensionContext context) {
95100
// QUERY SUBSYSTEM
@@ -100,7 +105,7 @@ public void initialize(ServiceExtensionContext context) {
100105
var queryEngine = new QueryEngineImpl(queryAdapterRegistry);
101106
context.registerService(QueryEngine.class, queryEngine);
102107
monitor = context.getMonitor();
103-
var catalogController = new FederatedCatalogApiController(monitor, queryEngine);
108+
var catalogController = new FederatedCatalogApiController(queryEngine);
104109
webService.registerResource(catalogController);
105110

106111
// contribute to the liveness probe
@@ -123,22 +128,18 @@ public void initialize(ServiceExtensionContext context) {
123128

124129
// lets create a simple partition manager
125130
partitionManager = createPartitionManager(context, updateResponseQueue, nodeQueryAdapterRegistry);
126-
127-
monitor.info("Federated Catalog Cache extension initialized");
128131
}
129132

130133
@Override
131134
public void start() {
132135
partitionManager.schedule(partitionManagerConfig.getExecutionPlan());
133136
loaderManager.start(updateResponseQueue);
134-
monitor.info("Federated Catalog Cache extension started");
135137
}
136138

137139
@Override
138140
public void shutdown() {
139141
partitionManager.stop();
140142
loaderManager.stop();
141-
monitor.info("Federated Catalog Cache extension stopped");
142143
}
143144

144145
@Provider(isDefault = true)
@@ -205,7 +206,7 @@ private CrawlerErrorHandler getErrorWorkItemConsumer(ServiceExtensionContext con
205206
} else {
206207
var random = new Random();
207208
var to = 5 + random.nextInt(20);
208-
context.getMonitor().info(format("The following work item has errored out. Will re-queue after a small delay: [%s]", workItem));
209+
context.getMonitor().debug(format("The following work item has errored out. Will re-queue after a small delay: [%s]", workItem));
209210
Executors.newSingleThreadScheduledExecutor().schedule(() -> workItems.offer(workItem), to, TimeUnit.SECONDS);
210211
}
211212
};

extensions/catalog/federated-catalog-cache/src/main/java/org/eclipse/dataspaceconnector/catalog/cache/controller/FederatedCatalogApiController.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.eclipse.dataspaceconnector.catalog.spi.QueryEngine;
2525
import org.eclipse.dataspaceconnector.catalog.spi.QueryResponse;
2626
import org.eclipse.dataspaceconnector.catalog.spi.model.FederatedCatalogCacheQuery;
27-
import org.eclipse.dataspaceconnector.spi.monitor.Monitor;
2827
import org.eclipse.dataspaceconnector.spi.types.domain.contract.offer.ContractOffer;
2928

3029
import java.util.Collection;
@@ -34,17 +33,14 @@
3433
@Path("/federatedcatalog")
3534
public class FederatedCatalogApiController {
3635

37-
private final Monitor monitor;
3836
private final QueryEngine queryEngine;
3937

40-
public FederatedCatalogApiController(Monitor monitor, QueryEngine queryEngine) {
41-
this.monitor = monitor;
38+
public FederatedCatalogApiController(QueryEngine queryEngine) {
4239
this.queryEngine = queryEngine;
4340
}
4441

4542
@POST
4643
public Collection<ContractOffer> getCachedCatalog(FederatedCatalogCacheQuery federatedCatalogCacheQuery) {
47-
monitor.info("Received a catalog request");
4844
var queryResponse = queryEngine.getCatalog(federatedCatalogCacheQuery);
4945
// query not possible
5046
if (queryResponse.getStatus() == QueryResponse.Status.NO_ADAPTER_FOUND) {

extensions/filesystem/configuration-fs/src/main/java/org/eclipse/dataspaceconnector/configuration/fs/FsConfigurationExtension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void initialize(Monitor monitor) {
6666
var configPath = configFile != null ? configFile : Paths.get(configLocation);
6767

6868
if (!Files.exists(configPath)) {
69-
monitor.info(format("Configuration file does not exist: %s. Ignoring.", configLocation));
69+
monitor.warning(format("Configuration file does not exist: %s. Ignoring.", configLocation));
7070
return;
7171
}
7272

extensions/iam/decentralized-identity/identity-did-service/src/main/java/org/eclipse/dataspaceconnector/identity/DecentralizedIdentityService.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public Result<ClaimToken> verifyJwtToken(TokenRepresentation tokenRepresentation
103103

104104
return Result.success(claimToken);
105105
} catch (ParseException e) {
106-
monitor.info("Error parsing JWT", e);
106+
monitor.severe("Error parsing JWT", e);
107107
return Result.failure("Error parsing JWT");
108108
}
109109
}

0 commit comments

Comments
 (0)