diff --git a/mod-audit-server/src/main/java/org/folio/builder/service/AbstractNoticeRecordBuilder.java b/mod-audit-server/src/main/java/org/folio/builder/service/AbstractNoticeRecordBuilder.java index f8503e34..a38ef1d3 100644 --- a/mod-audit-server/src/main/java/org/folio/builder/service/AbstractNoticeRecordBuilder.java +++ b/mod-audit-server/src/main/java/org/folio/builder/service/AbstractNoticeRecordBuilder.java @@ -70,7 +70,7 @@ private CompletableFuture fetchUserDetails(JsonObject payload) { LOGGER.debug("fetchUserDetails:: Fetching User Details"); String userBarcode = getProperty(payload, USER_BARCODE); - LOGGER.info("fetchUserDetails:: Fetched User Details with user barcode : {}", userBarcode); + LOGGER.info("fetchUserDetails:: Fetched user details"); return userBarcode != null ? fetchUserDetailsByUserBarcode(payload, userBarcode) : fetchUserDetails(payload, getProperty(payload, USER_ID)); diff --git a/mod-audit-server/src/main/java/org/folio/builder/service/LogRecordBuilder.java b/mod-audit-server/src/main/java/org/folio/builder/service/LogRecordBuilder.java index 762a0f3e..b6db7d18 100644 --- a/mod-audit-server/src/main/java/org/folio/builder/service/LogRecordBuilder.java +++ b/mod-audit-server/src/main/java/org/folio/builder/service/LogRecordBuilder.java @@ -61,7 +61,7 @@ public abstract class LogRecordBuilder { private static final Logger LOGGER = LogManager.getLogger(); private static final String OKAPI_URL = "x-okapi-url"; - private static final String EXCEPTION_CALLING_ENDPOINT_MSG = "Exception calling {} {}"; + private static final String EXCEPTION_CALLING_ENDPOINT_MSG = "Exception calling {} endpoint"; public static final String SEARCH_PARAMS = "?limit=%s&offset=%s%s"; public static final String ID = "id"; @@ -85,7 +85,7 @@ public LogRecordBuilder(Map okapiHeaders, Context vertxContext, } private CompletableFuture handleGetRequest(String endpoint) { - LOGGER.debug("handleGetRequest:: handling Get Request with endpoint : {}", endpoint); + LOGGER.debug("handleGetRequest:: Handling GET request"); CompletableFuture future = new CompletableFuture<>(); final String okapiURL = okapiHeaders.getOrDefault(OKAPI_URL, ""); @@ -93,11 +93,11 @@ private CompletableFuture handleGetRequest(String endpoint) { HttpClientInterface httpClient = HttpClientFactory.getHttpClient(okapiURL, tenantId); try { - LOGGER.debug("handleGetRequest::Calling GET {}", endpoint); + LOGGER.debug("handleGetRequest:: Calling GET endpoint"); httpClient.request(HttpMethod.GET, endpoint, okapiHeaders) .whenComplete((response, throwable) -> { if (Objects.nonNull(throwable)) { - LOGGER.error(EXCEPTION_CALLING_ENDPOINT_MSG, HttpMethod.GET, endpoint); + LOGGER.error(EXCEPTION_CALLING_ENDPOINT_MSG, HttpMethod.GET); future.completeExceptionally(throwable); } else { future.complete(verifyAndExtractBody(response)); @@ -105,7 +105,7 @@ private CompletableFuture handleGetRequest(String endpoint) { httpClient.closeClient(); }); } catch (Exception e) { - LOGGER.warn(EXCEPTION_CALLING_ENDPOINT_MSG, HttpMethod.GET, endpoint); + LOGGER.warn(EXCEPTION_CALLING_ENDPOINT_MSG, HttpMethod.GET); future.completeExceptionally(e); httpClient.closeClient(); } @@ -113,9 +113,9 @@ private CompletableFuture handleGetRequest(String endpoint) { } public CompletableFuture getEntitiesByQuery(String url, Class collection, int limit, int offset, String query) { - LOGGER.debug("getEntitiesByQuery:: Getting Entities By Query : {}", query); + LOGGER.debug("getEntitiesByQuery:: Getting entities by query"); String endpoint = String.format(url + SEARCH_PARAMS, limit, offset, buildQuery(query)); - LOGGER.debug("getEntitiesByQuery:: Entities successfully retrieved from endpoint: {}", endpoint); + LOGGER.debug("getEntitiesByQuery:: Entities successfully retrieved"); return handleGetRequest(endpoint).thenApply(response -> response.mapTo(collection)); } @@ -152,23 +152,23 @@ public CompletableFuture fetchTemplateName(JsonObject payload) { } public CompletableFuture fetchUserDetails(JsonObject payload, String userId) { - LOGGER.debug("fetchUserDetails:: Fetching user details for user Id : {}", userId); + LOGGER.debug("fetchUserDetails:: Fetching user details"); return getEntitiesByIds(USERS_URL, UserCollection.class, 1, 0, userId) .thenCompose(users -> { users.getUsers() .stream() .findFirst() .ifPresent(user -> updatePayload(payload, userId, user)); - LOGGER.debug("fetchUserDetails:: Fetched user details for user Id : {}", userId); + LOGGER.debug("fetchUserDetails:: Fetched user details"); return CompletableFuture.completedFuture(payload); }); } private void updatePayload(JsonObject payload, String userId, User user) { - LOGGER.debug("updatePayload:: Updating payload with details for user ID {}", userId); + LOGGER.debug("updatePayload:: Updating payload with user details"); if (nonNull(user)) { if (userId.equals(getProperty(payload, USER_ID))) { - LOGGER.debug("updatePayload:: Updating user id to payload because user id : {} matched with user id from payload", userId); + LOGGER.debug("updatePayload:: Updating user id in payload to match existing payload user id"); payload.put(USER_BARCODE.value(), user.getBarcode()); } fetchUserPersonal(payload, user); @@ -176,7 +176,7 @@ private void updatePayload(JsonObject payload, String userId, User user) { } public CompletableFuture fetchUserAndSourceDetails(JsonObject payload, String userId, String sourceId) { - LOGGER.debug("fetchUserAndSourceDetails:: Fetching user details for user Id : {} and source ID {}", userId, sourceId); + LOGGER.debug("fetchUserAndSourceDetails:: Fetching user and source details"); return getEntitiesByIds(USERS_URL, UserCollection.class, 2, 0, userId, sourceId) .thenCompose(users -> { Map usersGroupedById = StreamEx.of(users.getUsers()).collect(toMap(User::getId, identity())); @@ -190,24 +190,24 @@ public CompletableFuture fetchUserAndSourceDetails(JsonObject payloa payload.put(SOURCE.value(), buildPersonalName(source.getPersonal().getFirstName(), source.getPersonal().getLastName())); } - LOGGER.info("fetchUserAndSourceDetails:: Fetched user details for user Id : {} and source ID {}", userId, sourceId); + LOGGER.info("fetchUserAndSourceDetails:: Fetched user and source details"); return completedFuture(payload); }); } public CompletableFuture fetchUserDetailsByUserBarcode(JsonObject payload, String userBarcode) { - LOGGER.debug("fetchUserDetailsByUserBarcode:: Fetching user details by user barcode {}", userBarcode); + LOGGER.debug("fetchUserDetailsByUserBarcode:: Fetching user details by user barcode"); return getEntitiesByQuery(USERS_URL, UserCollection.class, 1, 0, "barcode==" + userBarcode) .thenCompose(users -> { var user = users.getUsers().get(0); if (nonNull(user)) { if (userBarcode.equals(getProperty(payload, USER_BARCODE))) { - LOGGER.info("fetchUserDetailsByUserBarcode:: Adding user id to payload because user barcode : {} matched with user barcode from payload", userBarcode); + LOGGER.info("fetchUserDetailsByUserBarcode:: Adding user id to payload because user barcode matched payload"); payload.put(USER_ID.value(), user.getId()); } fetchUserPersonal(payload, user); } - LOGGER.info("fetchUserDetailsByUserBarcode:: Fetched user details by user barcode {}", userBarcode); + LOGGER.info("fetchUserDetailsByUserBarcode:: Fetched user details by user barcode"); return completedFuture(payload); }); } @@ -242,12 +242,12 @@ private String buildQuery(String query) { * @return URL encoded string */ private String encodeQuery(String query) { - LOGGER.debug("encodeQuery:: Encoding Query : {}", query ); + LOGGER.debug("encodeQuery:: Encoding query"); try { LOGGER.debug("Encoded query"); return URLEncoder.encode(query, StandardCharsets.UTF_8.toString()); } catch (UnsupportedEncodingException e) { - LOGGER.warn("Error happened while attempting to encode '{}'", query); + LOGGER.warn("Error happened while attempting to encode query"); throw new CompletionException(e); } } @@ -314,14 +314,12 @@ private JsonObject extractFirstItem(JsonObject payload) { private static JsonObject verifyAndExtractBody(Response response) { LOGGER.debug("verifyAndExtractBody:: Verifying and Extracting Body"); - var endpoint = response.getEndpoint(); var code = response.getCode(); - var body = response.getBody(); if (!Response.isSuccess(code)) { - LOGGER.warn("Error calling {} with code {}, response body: {}", endpoint, code, body); + LOGGER.warn("Error calling downstream endpoint with code {}", code); return null; } - LOGGER.debug("verifyAndExtractBody:: The response body for GET {}: {}", endpoint, nonNull(body) ? body.encodePrettily() : null); + LOGGER.debug("verifyAndExtractBody:: Response body received for GET request"); LOGGER.info("verifyAndExtractBody:: Verifying and Extracting Body completed"); return response.getBody(); } @@ -342,15 +340,15 @@ protected LogRecord.Action resolveAction(String actionString) { } String buildPersonalName(String firstName, String lastName) { - LOGGER.debug("buildPersonalName:: Building Personal Name with firstname : {} and lastname : {}", firstName, lastName); + LOGGER.debug("buildPersonalName:: Building personal name"); if (isNotEmpty(firstName) && isNotEmpty(lastName)) { - LOGGER.debug("buildPersonalName:: Built Personal Name with firstname : {} and lastname : {}", firstName, lastName); + LOGGER.debug("buildPersonalName:: Built personal name from first and last name"); return lastName + ", " + firstName; } else if (isEmpty(firstName) && isNotEmpty(lastName)) { - LOGGER.debug("buildPersonalName:: Built Personal Name with lastname : {}", lastName); + LOGGER.debug("buildPersonalName:: Built personal name from last name"); return lastName; } else if (isNotEmpty(firstName) && isEmpty(lastName)) { - LOGGER.debug("buildPersonalName:: Built Personal Name with firstname : {}", firstName); + LOGGER.debug("buildPersonalName:: Built personal name from first name"); return firstName; } else { LOGGER.debug("buildPersonalName:: Error building personal name because there is no firstname and lastname"); diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceEventsDaoImpl.java index 67924884..68abc13c 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceEventsDaoImpl.java @@ -71,7 +71,7 @@ public Future getAuditEventsByInvoiceId(String invo } private Future> makeSaveCall(String query, InvoiceAuditEvent invoiceAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { return pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(invoiceAuditEvent.getId(), invoiceAuditEvent.getAction(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceLineEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceLineEventsDaoImpl.java index 73a43a3e..ba30afad 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceLineEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/InvoiceLineEventsDaoImpl.java @@ -73,7 +73,7 @@ public Future getAuditEventsByInvoiceLineId(Str } private Future> makeSaveCall(String query, InvoiceLineAuditEvent invoiceLineAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { return pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(invoiceLineAuditEvent.getId(), invoiceLineAuditEvent.getAction(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java index c3c844af..46796c91 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderEventsDaoImpl.java @@ -81,9 +81,9 @@ public Future getAuditEventsByOrderId(String orderId, } private void makeSaveCall(Promise> promise, String query, OrderAuditEvent orderAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { - LOGGER.info("makeSaveCall:: Trying to make save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.info("makeSaveCall:: Trying to make save call for tenant id : {}", tenantId); pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(orderAuditEvent.getId(), orderAuditEvent.getAction(), orderAuditEvent.getOrderId(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java index 77c61fb2..08e6cbe9 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrderLineEventsDaoImpl.java @@ -84,7 +84,7 @@ public Future getAuditEventsByOrderLineId(String } private void makeSaveCall(Promise> promise, String query, OrderLineAuditEvent orderLineAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(orderLineAuditEvent.getId(), orderLineAuditEvent.getAction(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrganizationEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrganizationEventsDaoImpl.java index 1762ded4..f697932b 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrganizationEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/OrganizationEventsDaoImpl.java @@ -71,7 +71,7 @@ public Future getAuditEventsByOrganizationId(S } private Future> makeSaveCall(String query, OrganizationAuditEvent organizationAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { return pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(organizationAuditEvent.getId(), organizationAuditEvent.getAction(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java index c5117de8..c395df6a 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/acquisition/impl/PieceEventsDaoImpl.java @@ -139,7 +139,7 @@ private PieceAuditEvent mapRowToPieceEvent(Row row) { } private void makeSaveCall(Promise> promise, String query, PieceAuditEvent pieceAuditEvent, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(pieceAuditEvent.getId(), pieceAuditEvent.getAction(), diff --git a/mod-audit-server/src/main/java/org/folio/dao/inventory/impl/InventoryEventDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/inventory/impl/InventoryEventDaoImpl.java index dfbe9dfb..2558a1e0 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/inventory/impl/InventoryEventDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/inventory/impl/InventoryEventDaoImpl.java @@ -123,7 +123,7 @@ public String tableName() { } private void makeSaveCall(Promise> promise, String query, InventoryAuditEntity event, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { pgClientFactory.createInstance(tenantId).execute(query, Tuple.of(event.eventId(), LocalDateTime.ofInstant(event.eventDate().toInstant(), ZoneId.systemDefault()), diff --git a/mod-audit-server/src/main/java/org/folio/dao/marc/impl/MarcAuditDaoImpl.java b/mod-audit-server/src/main/java/org/folio/dao/marc/impl/MarcAuditDaoImpl.java index b544b4b3..2efc8558 100644 --- a/mod-audit-server/src/main/java/org/folio/dao/marc/impl/MarcAuditDaoImpl.java +++ b/mod-audit-server/src/main/java/org/folio/dao/marc/impl/MarcAuditDaoImpl.java @@ -107,7 +107,7 @@ public Future deleteOlderThanDate(Timestamp eventDate, String tenantId, So } private Future> makeSaveCall(String query, MarcAuditEntity entity, String tenantId) { - LOGGER.debug("makeSaveCall:: Making save call with query : {} and tenant id : {}", query, tenantId); + LOGGER.debug("makeSaveCall:: Making save call for tenant id : {}", tenantId); try { return pgClientFactory.createInstance(tenantId).execute(query, Tuple.of( entity.eventId(), diff --git a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditDataImpl.java b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditDataImpl.java index 9063a49c..6f4d11bb 100644 --- a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditDataImpl.java +++ b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditDataImpl.java @@ -26,7 +26,7 @@ public class AuditDataImpl implements AuditData { public void getAuditData(String query, int offset, int limit, String lang, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { - LOGGER.debug("getAuditData:: Retrieving audit data with query: {}", query); + LOGGER.debug("getAuditData:: Retrieving audit data"); PgUtil.get(DB_TAB_AUDIT, Audit.class, AuditCollection.class, query, offset, limit, okapiHeaders, vertxContext, GetAuditDataResponse.class, asyncResultHandler); } diff --git a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java index e39a48be..b14e8dea 100644 --- a/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java +++ b/mod-audit-server/src/main/java/org/folio/rest/impl/AuditHandlersService.java @@ -33,7 +33,7 @@ public class AuditHandlersService extends BaseService implements AuditHandlers { @Validate public void postAuditHandlersLogRecord(String entity, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { - LOGGER.debug("postAuditHandlersLogRecord:: Trying to Save AuditHandlersLogRecord request with entity: {}", entity); + LOGGER.debug("postAuditHandlersLogRecord:: Trying to save AuditHandlersLogRecord request"); try { JsonObject payload = new JsonObject(entity); LogRecordBuilder builder = LogRecordBuilderResolver.getBuilder(payload.getString(LOG_EVENT_TYPE.value()), okapiHeaders, vertxContext); @@ -41,11 +41,11 @@ public void postAuditHandlersLogRecord(String entity, Map okapiH .thenCompose(logRecords -> processAnonymize(logRecords, okapiHeaders, vertxContext)) .thenCompose(logRecords -> saveLogRecords(logRecords, okapiHeaders, vertxContext)) .exceptionally(throwable -> { - LOGGER.warn("Error saving log event : {} due to : {}", entity, throwable.getLocalizedMessage()); + LOGGER.warn("Error saving log event due to: {}", throwable.getLocalizedMessage()); return null; }); } catch (Exception e) { - LOGGER.warn("Error saving log event for entity {} due to {} ", entity, e.getMessage()); + LOGGER.warn("Error saving log event due to {}", e.getMessage()); } finally { asyncResultHandler.handle(succeededFuture(PostAuditHandlersLogRecordResponse.respond204())); }