Skip to content
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

[serving] Improve logging for exec shell command #2569

Merged
merged 2 commits into from
Nov 22, 2024

Conversation

xyang16
Copy link
Contributor

@xyang16 xyang16 commented Nov 17, 2024

Description

Brief description of what this PR is about

Improve logging for exec shell command

@xyang16 xyang16 requested review from zachgk and a team as code owners November 17, 2024 00:40
@xyang16
Copy link
Contributor Author

xyang16 commented Nov 17, 2024

Raising PR on behalf of Frank.

@@ -54,6 +52,21 @@ public final class LmiUtils {

private LmiUtils() {}

static void exec(List<String> cmd) throws IOException, InterruptedException {
Copy link
Contributor

@siddvenk siddvenk Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed in this PR - we can do this as a follow up, but might be nice to put this into a generic ProcessUtils class or something similar. We have a few more places where we do this (like cluster request handler)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can make this in ProcessUtils class, but need to make error checking more generic, this class currently has logic specific for s3cmd:

logOutput.startsWith("ERROR ")

We can pass a regex if caller need extra error checking:

(regex != null && logOutput.matches(regex))

}
int exitCode = exec.waitFor();
if (0 != exitCode || logOutput.startsWith("ERROR ")) {
logger.info("{}", logOutput);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be logged at error level?

@siddvenk siddvenk merged commit 1ebc74e into deepjavalibrary:master Nov 22, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants