diff --git a/ramls/acq-models b/ramls/acq-models index a8f2fef0b..494a65e44 160000 --- a/ramls/acq-models +++ b/ramls/acq-models @@ -1 +1 @@ -Subproject commit a8f2fef0b41fbe99f917a39857821b93c417b1a9 +Subproject commit 494a65e44f01d3ad01dcc46947587d81ca955083 diff --git a/src/main/java/org/folio/helper/PurchaseOrderHelper.java b/src/main/java/org/folio/helper/PurchaseOrderHelper.java index ddf448de8..e2f914585 100644 --- a/src/main/java/org/folio/helper/PurchaseOrderHelper.java +++ b/src/main/java/org/folio/helper/PurchaseOrderHelper.java @@ -169,15 +169,13 @@ public Future postCompositeOrder(CompositePurchaseOrder if (CollectionUtils.isEmpty(errors)) { logger.info("postCompositeOrder :: Creating PO and POLines..."); return createPurchaseOrder(compPO, tenantConfig, requestContext) - .onSuccess(po -> logger.info("postCompositeOrder :: Successfully Placed Order: {}", - JsonObject.mapFrom(po).encodePrettily())); + .onSuccess(po -> logger.info("postCompositeOrder :: Successfully Placed Order")); } else { throw new HttpException(422, new Errors().withErrors(errors) .withTotalRecords(errors.size())); } })) - .onFailure(t -> logger.error("postCompositeOrder :: Failed to create order: {}", - JsonObject.mapFrom(compPO).encodePrettily(), t)); + .onFailure(t -> logger.error("postCompositeOrder :: Failed to create order", t)); } /** @@ -207,15 +205,14 @@ public Future putCompositeOrderById(String orderId, boolean deleteHoldings .map(validationErrors -> { if (CollectionUtils.isNotEmpty(validationErrors)) { Errors errors = new Errors().withErrors(validationErrors).withTotalRecords(validationErrors.size()); - logger.error("putCompositeOrderById :: Validation error. Failed to update purchase order : {}", + logger.error("putCompositeOrderById :: Validation error. Failed to update purchase order, errors: {}", JsonObject.mapFrom(errors).encodePrettily()); throw new HttpException(RestConstants.VALIDATION_ERROR, errors); } return null; }).compose(v -> updateOrder(compPO, deleteHoldings, requestContext)) - .onSuccess(v -> logger.info("putCompositeOrderById :: Successfully updated order: {}", compPO.getId())) - .onFailure(t -> logger.error("putCompositeOrderById :: Failed to update order: {}", - JsonObject.mapFrom(compPO).encodePrettily(), t)); + .onSuccess(v -> logger.info("putCompositeOrderById :: Successfully updated order, id: {}", compPO.getId())) + .onFailure(t -> logger.error("putCompositeOrderById :: Failed to update order", t)); } /** diff --git a/src/main/java/org/folio/helper/PurchaseOrderLineHelper.java b/src/main/java/org/folio/helper/PurchaseOrderLineHelper.java index 33ebe2c77..f39e6b927 100644 --- a/src/main/java/org/folio/helper/PurchaseOrderLineHelper.java +++ b/src/main/java/org/folio/helper/PurchaseOrderLineHelper.java @@ -189,7 +189,7 @@ public Future createPoLine(CompositePoLine compPOL, JsonObject .compose(v -> createPoLineWithOrder(compPOL, po, requestContext))); } var errors = new Errors().withErrors(validationErrors).withTotalRecords(validationErrors.size()); - logger.error("Create POL validation error : {}", JsonObject.mapFrom(errors).encodePrettily()); + logger.error("Create POL validation error: {}", JsonObject.mapFrom(errors).encodePrettily()); throw new HttpException(RestConstants.VALIDATION_ERROR, errors); }); } diff --git a/src/main/java/org/folio/orders/events/handlers/AbstractOrderStatusHandler.java b/src/main/java/org/folio/orders/events/handlers/AbstractOrderStatusHandler.java index cd6d82cb9..9a6060f6a 100644 --- a/src/main/java/org/folio/orders/events/handlers/AbstractOrderStatusHandler.java +++ b/src/main/java/org/folio/orders/events/handlers/AbstractOrderStatusHandler.java @@ -45,9 +45,6 @@ protected AbstractOrderStatusHandler(Context ctx, EncumbranceService encumbrance @Override public void handle(Message message) { - JsonObject body = message.body(); - logger.debug("Received message body: {}", body); - Map okapiHeaders = getOkapiHeaders(message); List> futures = new ArrayList<>(); @@ -103,7 +100,6 @@ protected Future updateOrderStatus(PurchaseOrder purchaseOrder, List message) { JsonObject body = message.body(); - logger.debug("Received message body: {}", body); return body.getJsonArray(rootElement); } diff --git a/src/main/java/org/folio/orders/events/handlers/ReceiptStatusConsistency.java b/src/main/java/org/folio/orders/events/handlers/ReceiptStatusConsistency.java index e234e935e..c640aa38e 100644 --- a/src/main/java/org/folio/orders/events/handlers/ReceiptStatusConsistency.java +++ b/src/main/java/org/folio/orders/events/handlers/ReceiptStatusConsistency.java @@ -42,11 +42,8 @@ public ReceiptStatusConsistency(Vertx vertx, PieceStorageService pieceStorageSer @Override public void handle(Message message) { var messageFromEventBus = message.body(); - logger.info("Received message body: {}", messageFromEventBus); - var okapiHeaders = getOkapiHeaders(message); var requestContext = new RequestContext(ctx, okapiHeaders); - var poLineId = getPoLineId(messageFromEventBus); var future = pieceStorageService.getPiecesByLineId(poLineId, requestContext) .compose(pieces -> purchaseOrderLineService.getOrderLineById(poLineId, requestContext) diff --git a/src/main/java/org/folio/rest/core/RestClient.java b/src/main/java/org/folio/rest/core/RestClient.java index 9a71d8a4e..1fe7b9933 100644 --- a/src/main/java/org/folio/rest/core/RestClient.java +++ b/src/main/java/org/folio/rest/core/RestClient.java @@ -14,7 +14,6 @@ import io.vertx.core.MultiMap; import io.vertx.core.Promise; import io.vertx.core.buffer.Buffer; -import io.vertx.core.http.HttpMethod; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.client.HttpResponse; import io.vertx.ext.web.client.WebClient; @@ -31,8 +30,6 @@ public class RestClient { private static final Logger log = LogManager.getLogger(RestClient.class); - private static final String CALLING_ENDPOINT_MSG = "Sending {} {}"; - private static final String SENDING_POST_WITH_BODY_MSG = "Sending 'POST {}' with body: {}"; private static final ErrorConverter ERROR_CONVERTER = ErrorConverter.createFullBody( result -> { @@ -48,9 +45,6 @@ public Future post(RequestEntry requestEntry, T entity, Class response } public Future post(String endpoint, T entity, Class responseType, RequestContext requestContext) { - if (log.isDebugEnabled()) { - log.debug(SENDING_POST_WITH_BODY_MSG, endpoint, JsonObject.mapFrom(entity).encodePrettily()); - } var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); return getVertxWebClient(requestContext.getContext()).postAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) .putHeaders(caseInsensitiveHeader) @@ -66,7 +60,6 @@ public Future post(String endpoint, T entity, Class responseType, Requ } public Future postEmptyResponse(String endpoint, T entity, RequestContext requestContext) { - log.debug(SENDING_POST_WITH_BODY_MSG, () -> endpoint, () -> JsonObject.mapFrom(entity).encodePrettily()); var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); return getVertxWebClient(requestContext.getContext()) .postAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) @@ -89,11 +82,7 @@ public Future put(RequestEntry requestEntry, T dataObject, RequestCont } public Future put(String endpoint, T dataObject, RequestContext requestContext) { var recordData = JsonObject.mapFrom(dataObject); - if (log.isDebugEnabled()) { - log.debug("Sending 'PUT {}' with body: {}", endpoint, recordData.encodePrettily()); - } var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); - return getVertxWebClient(requestContext.getContext()) .putAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) .putHeaders(caseInsensitiveHeader) @@ -109,14 +98,8 @@ public Future patch(RequestEntry requestEntry, T dataObject, RequestCon } public Future patch(String endpoint, T dataObject, RequestContext requestContext) { - var recordData = JsonObject.mapFrom(dataObject); - if (log.isDebugEnabled()) { - log.debug("Sending 'PATCH {}' with body: {}", endpoint, recordData.encodePrettily()); - } var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); - Promise promise = Promise.promise(); - return getVertxWebClient(requestContext.getContext()) .patchAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) .putHeaders(caseInsensitiveHeader) @@ -133,11 +116,8 @@ public Future delete(RequestEntry requestEntry, boolean skipError404, Requ } public Future delete(String endpointById, boolean skipError404, RequestContext requestContext) { - log.debug(CALLING_ENDPOINT_MSG, HttpMethod.DELETE, endpointById); - var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); Promise promise = Promise.promise(); - getVertxWebClient(requestContext.getContext()) .deleteAbs(buildAbsEndpoint(caseInsensitiveHeader, endpointById)) .putHeaders(caseInsensitiveHeader) @@ -185,9 +165,7 @@ public Future get(RequestEntry requestEntry, Class responseType, Reque } public Future get(String endpoint, boolean skipError404, Class responseType, RequestContext requestContext) { - log.debug("Calling GET {}", endpoint); var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); - Promise promise = Promise.promise(); getVertxWebClient(requestContext.getContext()) .getAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) @@ -195,12 +173,7 @@ public Future get(String endpoint, boolean skipError404, Class respons .expect(SUCCESS_RESPONSE_PREDICATE) .send() .map(HttpResponse::bodyAsJsonObject) - .map(jsonObject -> { - if (log.isDebugEnabled()) { - log.debug("Successfully retrieved: {}", jsonObject.encodePrettily()); - } - return jsonObject.mapTo(responseType); - }) + .map(jsonObject -> jsonObject.mapTo(responseType)) .onSuccess(promise::complete) .onFailure(t -> handleGetMethodErrorResponse(promise, t, skipError404)); @@ -209,22 +182,15 @@ public Future get(String endpoint, boolean skipError404, Class respons public Future getAsJsonObject(String endpoint, boolean skipError404, RequestContext requestContext) { - log.debug("Calling GET {}", endpoint); Promise promise = Promise.promise(); var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); var webClient = getVertxWebClient(requestContext.getContext()); - webClient.getAbs(buildAbsEndpoint(caseInsensitiveHeader, endpoint)) .putHeaders(caseInsensitiveHeader) .expect(SUCCESS_RESPONSE_PREDICATE) .send() .map(HttpResponse::bodyAsJsonObject) - .onSuccess(jsonObject -> { - if (log.isDebugEnabled()) { - log.debug("Successfully retrieved: {}", jsonObject.encodePrettily()); - } - promise.complete(jsonObject); - }) + .onSuccess(promise::complete) .onFailure(t -> handleGetMethodErrorResponse(promise, t, skipError404)); return promise.future(); } @@ -266,11 +232,7 @@ private String buildAbsEndpoint(MultiMap okapiHeaders, String endpoint) { } public Future postJsonObjectAndGetId(RequestEntry requestEntry, JsonObject entity, RequestContext requestContext) { - if (log.isDebugEnabled()) { - log.debug(SENDING_POST_WITH_BODY_MSG, requestEntry.buildEndpoint(), JsonObject.mapFrom(entity).encodePrettily()); - } var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); - return getVertxWebClient(requestContext.getContext()) .postAbs(buildAbsEndpoint(caseInsensitiveHeader, requestEntry.buildEndpoint())) .putHeaders(caseInsensitiveHeader) @@ -281,9 +243,6 @@ public Future postJsonObjectAndGetId(RequestEntry requestEntry, JsonObje } public Future postJsonObject(RequestEntry requestEntry, JsonObject jsonObject, RequestContext requestContext) { - if (log.isDebugEnabled()) { - log.debug(SENDING_POST_WITH_BODY_MSG, requestEntry.buildEndpoint(), jsonObject.encodePrettily()); - } var endpoint = requestEntry.buildEndpoint(); var caseInsensitiveHeader = convertToCaseInsensitiveMap(requestContext.getHeaders()); return getVertxWebClient(requestContext.getContext()).postAbs(buildAbsEndpoint(caseInsensitiveHeader, requestEntry.buildEndpoint())) diff --git a/src/main/java/org/folio/rest/impl/AcquisitionsUnitsApi.java b/src/main/java/org/folio/rest/impl/AcquisitionsUnitsApi.java index 48c27450a..a2df1eba6 100644 --- a/src/main/java/org/folio/rest/impl/AcquisitionsUnitsApi.java +++ b/src/main/java/org/folio/rest/impl/AcquisitionsUnitsApi.java @@ -26,7 +26,6 @@ import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.Vertx; -import io.vertx.core.json.JsonObject; public class AcquisitionsUnitsApi extends BaseApi implements AcquisitionsUnits { @@ -46,13 +45,8 @@ public void postAcquisitionsUnitsUnits(AcquisitionsUnit entity, Map> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.createAcquisitionsUnit(entity, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(unit -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully created new acquisitions unit: {} ", JsonObject.mapFrom(unit).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildResponseWithLocation( - okapiHeaders.get(OKAPI_URL), resourceByIdPath(ACQUISITIONS_UNITS, unit.getId()), unit))); - }) + .onSuccess(unit -> asyncResultHandler.handle(succeededFuture(buildResponseWithLocation( + okapiHeaders.get(OKAPI_URL), resourceByIdPath(ACQUISITIONS_UNITS, unit.getId()), unit)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } @@ -62,12 +56,7 @@ public void getAcquisitionsUnitsUnits(String query, String totalRecords, int off Handler> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.getAcquisitionsUnits(query, offset, limit, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(units -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved acquisitions units: {}", JsonObject.mapFrom(units).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildOkResponse(units))); - }) + .onSuccess(units -> asyncResultHandler.handle(succeededFuture(buildOkResponse(units)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } @@ -95,12 +84,7 @@ public void getAcquisitionsUnitsUnitsById(String id, Map okapiHe Handler> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.getAcquisitionsUnit(id, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(unit -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved acquisitions unit: {}", JsonObject.mapFrom(unit).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildOkResponse(unit))); - }) + .onSuccess(unit -> asyncResultHandler.handle(succeededFuture(buildOkResponse(unit)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } @@ -125,13 +109,8 @@ public void postAcquisitionsUnitsMemberships(AcquisitionsUnitMembership entity, Handler> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.createAcquisitionsUnitsMembership(entity, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(membership -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully created new acquisitions units membership: {}", JsonObject.mapFrom(membership).encodePrettily()); - } - asyncResultHandler.handle( - succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), resourceByIdPath(ACQUISITIONS_MEMBERSHIPS, membership.getId()), membership))); - }) + .onSuccess(membership -> asyncResultHandler.handle( + succeededFuture(buildResponseWithLocation(okapiHeaders.get(OKAPI_URL), resourceByIdPath(ACQUISITIONS_MEMBERSHIPS, membership.getId()), membership)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } @@ -140,12 +119,7 @@ public void postAcquisitionsUnitsMemberships(AcquisitionsUnitMembership entity, public void getAcquisitionsUnitsMemberships(String query, String totalRecords, int offset, int limit, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.getAcquisitionsUnitsMemberships(query, offset, limit, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(memberships -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved acquisitions units memberships: {}", JsonObject.mapFrom(memberships).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildOkResponse(memberships))); - }) + .onSuccess(memberships -> asyncResultHandler.handle(succeededFuture(buildOkResponse(memberships)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } @@ -169,12 +143,7 @@ public void putAcquisitionsUnitsMembershipsById(String id, AcquisitionsUnitMembe @Validate public void getAcquisitionsUnitsMembershipsById(String id, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { acquisitionsUnitsService.getAcquisitionsUnitsMembership(id, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(membership -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved acquisitions units membership: {}", JsonObject.mapFrom(membership).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildOkResponse(membership))); - }) + .onSuccess(membership -> asyncResultHandler.handle(succeededFuture(buildOkResponse(membership)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } diff --git a/src/main/java/org/folio/rest/impl/CompositePoLineAPI.java b/src/main/java/org/folio/rest/impl/CompositePoLineAPI.java index 07ee1da03..6fb480133 100644 --- a/src/main/java/org/folio/rest/impl/CompositePoLineAPI.java +++ b/src/main/java/org/folio/rest/impl/CompositePoLineAPI.java @@ -39,7 +39,6 @@ import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.Vertx; -import io.vertx.core.json.JsonObject; public class CompositePoLineAPI extends BaseApi implements OrdersOrderLines { private static final Logger logger = LogManager.getLogger(); @@ -87,13 +86,7 @@ public void getOrdersOrderLinesById(String lineId, Map okapiHead Handler> asyncResultHandler, Context vertxContext) { logger.debug("Started Invocation of POLine Request with id = {}", lineId); helper.getCompositePoLine(lineId, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(poLine -> { - if (logger.isInfoEnabled()) { - logger.debug("Received PO Line Response: {}", JsonObject.mapFrom(poLine) - .encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildOkResponse(poLine))); - }) + .onSuccess(poLine -> asyncResultHandler.handle(succeededFuture(buildOkResponse(poLine)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } diff --git a/src/main/java/org/folio/rest/impl/HoldingsSummaryAPI.java b/src/main/java/org/folio/rest/impl/HoldingsSummaryAPI.java index bcecde51a..c69303647 100644 --- a/src/main/java/org/folio/rest/impl/HoldingsSummaryAPI.java +++ b/src/main/java/org/folio/rest/impl/HoldingsSummaryAPI.java @@ -6,8 +6,6 @@ import javax.ws.rs.core.Response; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.folio.rest.annotations.Validate; import org.folio.rest.core.models.RequestContext; import org.folio.rest.jaxrs.resource.OrdersHoldingSummary; @@ -19,12 +17,9 @@ import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.Vertx; -import io.vertx.core.json.JsonObject; public class HoldingsSummaryAPI extends BaseApi implements OrdersHoldingSummary { - private static final Logger logger = LogManager.getLogger(); - @Autowired private HoldingsSummaryService holdingsSummaryService; @@ -40,12 +35,7 @@ public void getOrdersHoldingSummaryById(String holdingId, Map ok var requestContext = new RequestContext(vertxContext, okapiHeaders); holdingsSummaryService.getHoldingsSummary(holdingId, requestContext) - .onSuccess(holdingSummary -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved : {}", JsonObject.mapFrom(holdingSummary).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(this.buildOkResponse(holdingSummary))); - }) + .onSuccess(holdingSummary -> asyncResultHandler.handle(succeededFuture(this.buildOkResponse(holdingSummary)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } diff --git a/src/main/java/org/folio/rest/impl/OrderTemplatesAPI.java b/src/main/java/org/folio/rest/impl/OrderTemplatesAPI.java index 3fd4e642f..5ee4d98f7 100644 --- a/src/main/java/org/folio/rest/impl/OrderTemplatesAPI.java +++ b/src/main/java/org/folio/rest/impl/OrderTemplatesAPI.java @@ -21,7 +21,6 @@ import io.vertx.core.AsyncResult; import io.vertx.core.Context; import io.vertx.core.Handler; -import io.vertx.core.json.JsonObject; public class OrderTemplatesAPI implements OrdersOrderTemplates { @@ -35,14 +34,8 @@ public void postOrdersOrderTemplates(OrderTemplate entity, Map o Handler> asyncResultHandler, Context vertxContext) { OrderTemplatesHelper orderTemplatesHelper = new OrderTemplatesHelper(okapiHeaders, vertxContext); orderTemplatesHelper.createOrderTemplate(entity) - .onSuccess(template -> { - if (logger.isDebugEnabled()) { - logger.debug("Successfully created new order template: {}", JsonObject.mapFrom(template) - .encodePrettily()); - } - asyncResultHandler.handle(succeededFuture( - orderTemplatesHelper.buildResponseWithLocation(String.format(ORDER_TEMPLATE_LOCATION_PREFIX, template.getId()), template))); - }) + .onSuccess(template -> asyncResultHandler.handle(succeededFuture( + orderTemplatesHelper.buildResponseWithLocation(String.format(ORDER_TEMPLATE_LOCATION_PREFIX, template.getId()), template)))) .onFailure(t -> handlePostPutErrorResponse(asyncResultHandler, t, orderTemplatesHelper)); } diff --git a/src/main/java/org/folio/rest/impl/PiecesAPI.java b/src/main/java/org/folio/rest/impl/PiecesAPI.java index 91a9028fe..693cbd1ad 100644 --- a/src/main/java/org/folio/rest/impl/PiecesAPI.java +++ b/src/main/java/org/folio/rest/impl/PiecesAPI.java @@ -8,8 +8,6 @@ import javax.ws.rs.core.Response; import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.folio.rest.annotations.Validate; import org.folio.rest.core.models.RequestContext; import org.folio.rest.jaxrs.model.Piece; @@ -29,11 +27,9 @@ import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.Vertx; -import io.vertx.core.json.JsonObject; public class PiecesAPI extends BaseApi implements OrdersPieces, OrdersPiecesRequests, OrdersPiecesBatch { - private static final Logger logger = LogManager.getLogger(); @Autowired private PieceStorageService pieceStorageService; @Autowired @@ -63,12 +59,7 @@ public void getOrdersPieces(String totalRecords, int offset, int limit, String q public void postOrdersPieces(boolean createItem, Piece entity, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { pieceCreateFlowManager.createPiece(entity, createItem, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(piece -> { - if (logger.isDebugEnabled()) { - logger.debug("Successfully created piece: {}", JsonObject.mapFrom(piece).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(buildCreatedResponse(piece))); - }) + .onSuccess(piece -> asyncResultHandler.handle(succeededFuture(buildCreatedResponse(piece)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, t)); } diff --git a/src/main/java/org/folio/rest/impl/ReceivingAPI.java b/src/main/java/org/folio/rest/impl/ReceivingAPI.java index 453351c78..e74063542 100644 --- a/src/main/java/org/folio/rest/impl/ReceivingAPI.java +++ b/src/main/java/org/folio/rest/impl/ReceivingAPI.java @@ -32,7 +32,6 @@ import io.vertx.core.AsyncResult; import io.vertx.core.Context; import io.vertx.core.Handler; -import io.vertx.core.json.JsonObject; public class ReceivingAPI implements OrdersReceive, OrdersCheckIn, OrdersExpect, OrdersBindPieces, OrdersReceivingHistory { @@ -53,7 +52,7 @@ public void postOrdersReceive(ReceivingCollection entity, Map ok @Validate public void postOrdersCheckIn(CheckinCollection entity, Map okapiHeaders, Handler> asyncResultHandler, Context vertxContext) { - logger.debug("Checkin {} items", entity.getTotalRecords()); + logger.debug("CheckIn {} items", entity.getTotalRecords()); CheckinHelper helper = new CheckinHelper(entity, okapiHeaders, vertxContext); helper.checkinPieces(entity, new RequestContext(vertxContext, okapiHeaders)) .onSuccess(result -> asyncResultHandler.handle(succeededFuture(helper.buildOkResponse(result)))) @@ -96,12 +95,7 @@ public void getOrdersReceivingHistory(String totalRecords, int offset, int limit ReceivingHelper helper = new ReceivingHelper(okapiHeaders, vertxContext); helper.getReceivingHistory(limit, offset, query, new RequestContext(vertxContext, okapiHeaders)) - .onSuccess(receivingHistory -> { - if (logger.isInfoEnabled()) { - logger.debug("Successfully retrieved receiving history: {} ", JsonObject.mapFrom(receivingHistory).encodePrettily()); - } - asyncResultHandler.handle(succeededFuture(helper.buildOkResponse(receivingHistory))); - }) + .onSuccess(receivingHistory -> asyncResultHandler.handle(succeededFuture(helper.buildOkResponse(receivingHistory)))) .onFailure(t -> handleErrorResponse(asyncResultHandler, helper, t)); } diff --git a/src/main/java/org/folio/service/CirculationRequestsRetriever.java b/src/main/java/org/folio/service/CirculationRequestsRetriever.java index 3b5c329a4..bb4a54fe6 100644 --- a/src/main/java/org/folio/service/CirculationRequestsRetriever.java +++ b/src/main/java/org/folio/service/CirculationRequestsRetriever.java @@ -71,7 +71,9 @@ public Future>> getRequesterIdsToRequestsByItemIds( } private Future> getRequestsByItemIds(List itemIds, String status, RequestContext requestContext) { - log.debug("getRequestsByItemIds:: Fetching requests by item ids: {}", itemIds); + if (log.isDebugEnabled()) { + log.debug("getRequestsByItemIds:: Fetching requests by item ids: {}", itemIds); + } var futures = StreamEx.ofSubLists(itemIds, MAX_IDS_FOR_GET_RQ_15) .map(ids -> String.format("(%s and status=\"%s\")", convertIdsToCqlQuery(ids, ITEM_ID.getValue()), status)) .map(query -> new RequestEntry(INVENTORY_LOOKUP_ENDPOINTS.get(REQUESTS)) diff --git a/src/main/java/org/folio/service/configuration/ConfigurationEntriesService.java b/src/main/java/org/folio/service/configuration/ConfigurationEntriesService.java index 9a1abddd2..f92ab7586 100644 --- a/src/main/java/org/folio/service/configuration/ConfigurationEntriesService.java +++ b/src/main/java/org/folio/service/configuration/ConfigurationEntriesService.java @@ -32,9 +32,6 @@ public ConfigurationEntriesService(RestClient restClient) { public Future loadConfiguration(RequestEntry requestEntry, RequestContext requestContext) { return restClient.get(requestEntry, Configs.class, requestContext) .map(configs -> { - if (log.isDebugEnabled()) { - log.debug("The response from mod-configuration: {}", JsonObject.mapFrom(configs).encodePrettily()); - } var config = new JsonObject(); configs.getConfigs() .forEach(entry -> config.put(entry.getConfigName(), entry.getValue())); diff --git a/src/main/java/org/folio/service/dataimport/handlers/OrderPostProcessingEventHandler.java b/src/main/java/org/folio/service/dataimport/handlers/OrderPostProcessingEventHandler.java index a2cb06f1f..50fc733b2 100644 --- a/src/main/java/org/folio/service/dataimport/handlers/OrderPostProcessingEventHandler.java +++ b/src/main/java/org/folio/service/dataimport/handlers/OrderPostProcessingEventHandler.java @@ -108,7 +108,7 @@ private Future openOrder(CompositePoLine poLine, RequestContext requestCon private Future ensurePoLineWithInstanceId(CompositePoLine poLine, DataImportEventPayload dataImportEventPayload, RequestContext requestContext) { if (PoLineCommonUtil.isInventoryUpdateNotRequired(poLine)) { - LOGGER.debug("ensurePoLineWithInstanceId:: Skipping instanceId filling because poLine does not require inventory entities creation, jobExecutionId: {}, poLineNumber: {}", + LOGGER.debug("ensurePoLineWithInstanceId:: Skipping instanceId filling because poLine does not require inventory entities creation, jobExecutionId: {}, poLineNumber: {}", dataImportEventPayload.getJobExecutionId(), poLine.getPoLineNumber()); return Future.succeededFuture(); } diff --git a/src/main/java/org/folio/service/finance/transaction/EncumbranceService.java b/src/main/java/org/folio/service/finance/transaction/EncumbranceService.java index b0e4b25d6..a5f580abb 100644 --- a/src/main/java/org/folio/service/finance/transaction/EncumbranceService.java +++ b/src/main/java/org/folio/service/finance/transaction/EncumbranceService.java @@ -152,7 +152,7 @@ private List prepareTransactionsToDelete(List updateEncumbrancesOrderStatusAndReleaseIfClosed(CompositePurchaseOrder compPo, RequestContext requestContext) { - logger.info("updateEncumbrancesOrderStatusAndReleaseIfClosed:: orderId {} ", compPo.getId()); + logger.info("updateEncumbrancesOrderStatusAndReleaseIfClosed:: orderId {}", compPo.getId()); return getOrderEncumbrancesForCurrentFiscalYear(compPo, requestContext).compose(encumbrances -> { List toUpdate = encumbrancesToUpdate(compPo.getWorkflowStatus(), encumbrances); if (!toUpdate.isEmpty()) { diff --git a/src/main/java/org/folio/service/finance/transaction/TransactionService.java b/src/main/java/org/folio/service/finance/transaction/TransactionService.java index 6502d457f..93b79ed98 100644 --- a/src/main/java/org/folio/service/finance/transaction/TransactionService.java +++ b/src/main/java/org/folio/service/finance/transaction/TransactionService.java @@ -16,7 +16,6 @@ import java.util.UUID; import java.util.stream.Collectors; -import io.vertx.core.json.JsonObject; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.folio.rest.acq.model.finance.Batch; @@ -109,7 +108,7 @@ public Future batchAllOrNothing(List transactionsToCreate, Li } return restClient.postEmptyResponse(resourcesPath(FINANCE_BATCH_TRANSACTIONS), batch, requestContext) .onSuccess(v -> log.info("batchAllOrNothing completed successfully")) - .onFailure(t -> log.error("batchAllOrNothing failed, batch={}", JsonObject.mapFrom(batch), t)); + .onFailure(t -> log.error("batchAllOrNothing failed", t)); } public Future batchCreate(List transactions, RequestContext requestContext) { diff --git a/src/main/java/org/folio/service/inventory/InventoryHoldingManager.java b/src/main/java/org/folio/service/inventory/InventoryHoldingManager.java index 8b93a3096..25e4de155 100644 --- a/src/main/java/org/folio/service/inventory/InventoryHoldingManager.java +++ b/src/main/java/org/folio/service/inventory/InventoryHoldingManager.java @@ -188,7 +188,7 @@ public Future> getHoldingRecords(String instanceId, List { if (logger.isDebugEnabled()) { String deletedIds = holdings.stream().map(holding -> holding.getString(ID)).collect(Collectors.joining(",")); - logger.debug(String.format("Holding ids : %s", deletedIds)); + logger.debug("Holding ids: {}", deletedIds); } return holdings.stream().filter(Objects::nonNull).collect(toList()); }); diff --git a/src/main/java/org/folio/service/inventory/InventoryInstanceManager.java b/src/main/java/org/folio/service/inventory/InventoryInstanceManager.java index 0c0711397..d76cc8027 100644 --- a/src/main/java/org/folio/service/inventory/InventoryInstanceManager.java +++ b/src/main/java/org/folio/service/inventory/InventoryInstanceManager.java @@ -210,7 +210,6 @@ private Future createInstanceRecord(CompositePoLine compPOL, RequestCont return CompositeFuture.join(instanceTypeFuture, statusFuture, contributorNameTypeIdFuture) .map(v -> buildInstanceRecordJsonObject(compPOL, lookupObj)) .compose(instanceRecJson -> { - logger.debug("Instance record to save : {}", instanceRecJson); RequestEntry requestEntry = new RequestEntry(INVENTORY_LOOKUP_ENDPOINTS.get(INSTANCES)); return restClient.postJsonObjectAndGetId(requestEntry, instanceRecJson, requestContext); }); diff --git a/src/main/java/org/folio/service/inventory/InventoryItemManager.java b/src/main/java/org/folio/service/inventory/InventoryItemManager.java index 17c410fb8..c92a14d2a 100644 --- a/src/main/java/org/folio/service/inventory/InventoryItemManager.java +++ b/src/main/java/org/folio/service/inventory/InventoryItemManager.java @@ -447,8 +447,7 @@ private Future createItemInInventory(JsonObject itemData, RequestContext promise.fail(new HttpException(409, BARCODE_IS_NOT_UNIQUE)); } else { var causeParam = new Parameter().withKey("cause").withValue(t.getMessage()); - logger.error("Failed to create an item: {} in inventory, tenantId: {}", - itemData.encodePrettily(), tenantId, t); + logger.error("Failed to create an item in inventory, tenantId: {}", tenantId, t); promise.fail(new HttpException(500, ITEM_CREATION_FAILED, List.of(causeParam))); } }); diff --git a/src/main/java/org/folio/service/orders/PurchaseOrderLineService.java b/src/main/java/org/folio/service/orders/PurchaseOrderLineService.java index fd72f14e0..738d189cc 100644 --- a/src/main/java/org/folio/service/orders/PurchaseOrderLineService.java +++ b/src/main/java/org/folio/service/orders/PurchaseOrderLineService.java @@ -223,23 +223,15 @@ public Future> getCompositePoLinesByOrderId(String orderId public Future operateOnPoLine(HttpMethod operation, PoLine poline, RequestContext requestContext) { Promise promise = Promise.promise(); JsonObject line = JsonObject.mapFrom(poline); - if (logger.isDebugEnabled()) { - logger.debug("The PO line prior to {} operation: {}", operation, line.encodePrettily()); - } List> futures = new ArrayList<>(); futures.addAll(operateOnSubObjsIfPresent(operation, line, ALERTS, requestContext)); futures.addAll(operateOnSubObjsIfPresent(operation, line, REPORTING_CODES, requestContext)); GenericCompositeFuture.join(new ArrayList<>(futures)) - .onSuccess(v -> { - if (logger.isDebugEnabled()) { - logger.debug("The PO line after {} operation on sub-objects: {}", operation, line.encodePrettily()); - } - promise.complete(line.mapTo(CompositePoLine.class)); - }) + .onSuccess(v -> promise.complete(line.mapTo(CompositePoLine.class))) .onFailure(t -> { - logger.error("Exception resolving one or more poLine sub-object(s) on {} operation", operation,t); + logger.error("Exception resolving one or more poLine sub-object(s) on {} operation", operation, t); promise.fail(t); }); return promise.future(); @@ -286,7 +278,7 @@ else if (operation.equals(HttpMethod.DELETE)) future .onSuccess(jsonResponse -> { - logger.info("The {} {} operation completed with following response body: {}", operation, url, jsonResponse.encodePrettily()); + logger.info("The {} {} operation completed", operation, url); promise.complete(jsonResponse); }) .onFailure(t -> { diff --git a/src/main/java/org/folio/service/orders/flows/update/unopen/UnOpenCompositeOrderManager.java b/src/main/java/org/folio/service/orders/flows/update/unopen/UnOpenCompositeOrderManager.java index 6d7c667dd..a04d10905 100644 --- a/src/main/java/org/folio/service/orders/flows/update/unopen/UnOpenCompositeOrderManager.java +++ b/src/main/java/org/folio/service/orders/flows/update/unopen/UnOpenCompositeOrderManager.java @@ -29,7 +29,6 @@ import org.folio.models.ItemStatus; import org.folio.models.pieces.PieceDeletionHolder; import org.folio.okapi.common.GenericCompositeFuture; -import org.folio.orders.utils.HelperUtils; import org.folio.orders.utils.PoLineCommonUtil; import org.folio.rest.core.exceptions.ErrorCodes; import org.folio.rest.core.exceptions.HttpException; @@ -164,7 +163,7 @@ private Future processInventory(CompositePoLine compPOL, boolean deleteHol return deleteExpectedPieces(compPOL, requestContext).onSuccess(pieces -> { if (logger.isDebugEnabled()) { String deletedIds = pieces.stream().map(Piece::getId).collect(Collectors.joining(",")); - logger.debug(String.format("Pieces were removed : %s", deletedIds)); + logger.debug("Pieces were removed: {}", deletedIds); } }) .mapEmpty(); @@ -239,7 +238,7 @@ private Future>> deleteHoldings(String tenantId, List< .map(resultDeletedHoldingVsLocationIds -> { if (logger.isDebugEnabled()) { String deletedIds = resultDeletedHoldingVsLocationIds.stream().map(Pair::getKey).collect(Collectors.joining(",")); - logger.debug(String.format("Holdings were removed : %s", deletedIds)); + logger.debug("Holdings were removed: {}", deletedIds); } return resultDeletedHoldingVsLocationIds; }); @@ -352,7 +351,7 @@ private Future>> deleteHoldingsByItems(List> deletePiecesAndItems(List onOrderIt return collectResultsOnSuccess(deletedItems).map(resultDeletedItems -> { if (logger.isDebugEnabled()) { String deletedIds = resultDeletedItems.stream().map(item -> item.getString(ID)).collect(Collectors.joining(",")); - logger.debug(String.format("Item were removed : %s", deletedIds)); + logger.debug("Item were removed: {}", deletedIds); } return resultDeletedItems; }); diff --git a/src/main/java/org/folio/service/pieces/PiecesClaimingService.java b/src/main/java/org/folio/service/pieces/PiecesClaimingService.java index 691df4322..b4ed27d2b 100644 --- a/src/main/java/org/folio/service/pieces/PiecesClaimingService.java +++ b/src/main/java/org/folio/service/pieces/PiecesClaimingService.java @@ -168,7 +168,7 @@ private Organization findFirstMissingVendorWithoutIntegrationDetail(JsonObject c var vendorIntegrationDetails = config.stream() .filter(configEntry -> isExportTypeClaimsAndCorrectVendorId(vendor.getId(), configEntry)) .toList(); - log.info("checkVendorIntegrationDetails:: Found vendor integration details, vendorId: {}, integrationDetails: {}", vendor.getId(), vendorIntegrationDetails); + log.info("checkVendorIntegrationDetails:: Found vendor integration details, vendorId: {}, integrationDetails: {}", vendor.getId(), vendorIntegrationDetails.size()); return vendorIntegrationDetails.isEmpty(); }) .findFirst().orElse(null); diff --git a/src/main/java/org/folio/service/pieces/flows/DefaultPieceFlowsValidator.java b/src/main/java/org/folio/service/pieces/flows/DefaultPieceFlowsValidator.java index 1bc80aae8..74a8cdc57 100644 --- a/src/main/java/org/folio/service/pieces/flows/DefaultPieceFlowsValidator.java +++ b/src/main/java/org/folio/service/pieces/flows/DefaultPieceFlowsValidator.java @@ -41,7 +41,7 @@ public void isPieceRequestValid(Piece pieceToCreate, CompositePurchaseOrder orig combinedErrors.addAll(relatedOrderErrors); if (CollectionUtils.isNotEmpty(combinedErrors)) { Errors errors = new Errors().withErrors(combinedErrors).withTotalRecords(combinedErrors.size()); - logger.error("Validation error : " + JsonObject.mapFrom(errors).encodePrettily()); + if (logger.isErrorEnabled()) logger.error("Validation error: {}", JsonObject.mapFrom(errors).encodePrettily()); throw new HttpException(RestConstants.BAD_REQUEST, errors); } }