-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ACS-8766: Adjust live-ingester logging to be more descriptive in case of error #666
Merged
krdabrowski
merged 21 commits into
master
from
feature/ACS-8766-Adjust-live-ingester-logging-to-be-more-descriptive-in-case-of-error
Sep 24, 2024
Merged
Changes from 4 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
3c792b4
ACS-8766: Adjust live-ingester logging to be more descriptive in DEBU…
krdabrowski ab68b8e
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski ef579f1
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski 367f98f
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski f0ee3c6
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski 65e4b3b
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski 300c6f8
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski 700d7db
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski b9e4903
ACS-8766: Adjust live-ingester logging to be more descriptive
krdabrowski 2beb46f
ACS-8766: Adjust live-ingester logging to be more descriptive - PMD
krdabrowski 915a858
ACS-8766: Adjust live-ingester logging to be more descriptive - tests
krdabrowski de0dcb3
Merge branch 'master' into feature/ACS-8766-Adjust-live-ingester-logg…
krdabrowski 5f0b08a
ACS-8766: Adjust live-ingester logging to be more descriptive - PR co…
krdabrowski bc0c88a
ACS-8766: Adjust live-ingester logging to be more descriptive - PMD
krdabrowski 11cf350
ACS-8766: Adjust live-ingester logging to be more descriptive - comments
krdabrowski 5b79ae4
Merge branch 'master' into feature/ACS-8766-Adjust-live-ingester-logg…
krdabrowski dcde0cc
ACS-8766: Adjust live-ingester logging to be more descriptive - addre…
krdabrowski afc182d
ACS-8766: Adjust live-ingester logging to be more descriptive - addre…
krdabrowski 5defe0c
ACS-8766: Adjust live-ingester logging to be more descriptive - addre…
krdabrowski 9269827
ACS-8766: Adjust live-ingester logging to be more descriptive - addre…
krdabrowski 1cda8e4
ACS-8766: Adjust live-ingester logging to be more descriptive - addre…
krdabrowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
import static java.nio.charset.StandardCharsets.UTF_8; | ||
|
||
import static org.apache.camel.Exchange.HTTP_RESPONSE_CODE; | ||
import static org.apache.camel.LoggingLevel.ERROR; | ||
|
||
import static org.alfresco.hxi_connector.common.util.ErrorUtils.UNEXPECTED_STATUS_CODE_MESSAGE; | ||
|
||
|
@@ -42,7 +43,6 @@ | |
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.Exchange; | ||
import org.apache.camel.LoggingLevel; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.http.HttpMethods; | ||
import org.apache.commons.lang3.StringUtils; | ||
|
@@ -73,8 +73,10 @@ public class HttpFileUploader extends RouteBuilder implements FileUploader | |
public void configure() | ||
{ | ||
// @formatter:off | ||
String uploadEndpoint = "${headers." + STORAGE_LOCATION_HEADER + "}&throwExceptionOnFailure=false"; | ||
onException(Exception.class) | ||
.log(LoggingLevel.ERROR, log, "Upload :: Unexpected response while uploading to S3. Body: ${body}") | ||
.log(ERROR, log, "Storage :: Unexpected response while uploading content - Endpoint: %s".formatted(uploadEndpoint)) | ||
.to("log:%s?level=ERROR&multiline=true&showBody=true&showHeaders=true&showProperties=true&showStackTrace=true".formatted(log.getName())) | ||
.process(this::wrapErrorIfNecessary) | ||
.stop(); | ||
|
||
|
@@ -83,7 +85,7 @@ public void configure() | |
.setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.PUT)) | ||
.marshal() | ||
.mimeMultipart() | ||
.toD("${headers." + STORAGE_LOCATION_HEADER + "}&throwExceptionOnFailure=false") | ||
.toD(uploadEndpoint) | ||
.choice() | ||
.when(header(HTTP_RESPONSE_CODE).isNotEqualTo(String.valueOf(EXPECTED_STATUS_CODE))) | ||
.process(this::throwExceptionOnUnexpectedStatusCode) | ||
|
@@ -112,7 +114,7 @@ STORAGE_LOCATION_HEADER, wrapRawToken(fileUploadRequest.storageLocation()), | |
.withHeaders(headers) | ||
.withBody(fileData) | ||
.request(); | ||
log.atDebug().log("Upload :: {} rendition of the node: {} successfully uploaded to pre-signed URL: {}", fileUploadRequest.contentType(), nodeId, fileUploadRequest.storageLocation().getPath()); | ||
log.info("Storage :: Rendition of type: {} for node: {} successfully uploaded to pre-signed URL: {}", fileUploadRequest.contentType(), nodeId, fileUploadRequest.storageLocation().getPath()); | ||
} | ||
catch (Exception e) | ||
{ | ||
|
@@ -123,7 +125,7 @@ STORAGE_LOCATION_HEADER, wrapRawToken(fileUploadRequest.storageLocation()), | |
} | ||
catch (IOException ioe) | ||
{ | ||
log.atDebug().log("Upload :: Stream reset failed due to: {}", ioe.getMessage()); | ||
log.warn("Storage :: Rendition stream NOT reset properly after node %s content upload fail due to: %s".formatted(nodeId, ioe.getMessage()), ioe); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly I think we want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed - thanks! |
||
throw e; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use
atInfo()
to avoid the PMD issue (since PMD doesn't know how long the calls tocontentType()
,storageLocation()
andgetPath()
will take).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed - thanks!