diff --git a/src/main/java/uk/ac/ebi/eva/submission/service/GlobusDirectoryProvisioner.java b/src/main/java/uk/ac/ebi/eva/submission/service/GlobusDirectoryProvisioner.java index a90d9db..ef66565 100644 --- a/src/main/java/uk/ac/ebi/eva/submission/service/GlobusDirectoryProvisioner.java +++ b/src/main/java/uk/ac/ebi/eva/submission/service/GlobusDirectoryProvisioner.java @@ -1,5 +1,7 @@ package uk.ac.ebi.eva.submission.service; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; @@ -14,6 +16,8 @@ @Service public class GlobusDirectoryProvisioner { + private final Logger logger = LoggerFactory.getLogger(GlobusDirectoryProvisioner.class); + private final GlobusTokenRefreshService globusTokenRefreshService; private final RestTemplate restTemplate; @@ -59,9 +63,9 @@ private void createDirectory(String directoryToCreate) { // Check the response status and handle errors if necessary if (response.getStatusCode().is2xxSuccessful()) { - System.out.printf("Directory '%s' created successfully%n", directoryToCreate); + logger.info("Directory '%s' created successfully%n", directoryToCreate); } else { - System.out.printf("Failed to create directory '%s': %s", directoryToCreate, response.getStatusCode()); + logger.error("Failed to create directory '%s': %s", directoryToCreate, response.getStatusCode()); } } @@ -83,10 +87,10 @@ public String listSubmittedFiles(String submissionDirPath) { ResponseEntity response = restTemplate.exchange(transferApiUrl, HttpMethod.GET, requestEntity, String.class); if (response.getStatusCode().is2xxSuccessful()) { - System.out.printf("Directory %s listed successfully%n", submissionDirPath); + logger.info("Directory %s listed successfully%n", submissionDirPath); return response.getBody(); } else { - System.out.printf("Failed to retrieve directory '%s': %s", submissionDirPath, response.getStatusCode()); + logger.error("Failed to retrieve directory '%s': %s", submissionDirPath, response.getStatusCode()); return ""; } }