-
Notifications
You must be signed in to change notification settings - Fork 280
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
ticdc/server: output the cdc server cmd error to stderr #3520
ticdc/server: output the cdc server cmd error to stderr #3520
Conversation
…oubleshooting from cdc_stderr.log
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
pkg/cmd/cmd.go
Outdated
// Outputs cmd.Print to stdout. | ||
cmd.SetOut(os.Stdout) | ||
// Outputs cmd.Print to stderr. | ||
cmd.SetOut(os.Stderr) |
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.
Could you redrict err output to stderr?
cmd.SetOut(os.Stdout)
cmd.SetErr(os.Stderr)
...
cmd.PrintErr(err) // line 48
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.
Yes, use cmd.PrintErr
to print error message to stderr is more natural. And maybe we should use cmd.PrintErrln
here to print error with new line. But after testing with cmd.PrintErrln
, it does not work as expected. cmd.PrintErrln
prints error message to stdout, see cobra issue 1100.
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.
Maybe we can replace v1.0.0 cobra with v1.2.1 in go.mod.
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.
Yes, let's upgrade cobra.
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.
LGTM.
@zhaoxinyu Could you please resolve the conflicting? Thanks! |
@hi-rustin, conflicts resolved. |
/merge |
This pull request has been accepted and is ready to merge. Commit hash: f367857
|
/merge |
This pull request has been accepted and is ready to merge. Commit hash: c67ff9d
|
/run-cherry-picker |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3872. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3873. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3874. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3875. |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
In response to a cherrypick label: new pull request created: #3876. |
What problem does this PR solve?
issue 3133
What is changed and how it works?
Make stderr as cdc server's cmd error destination. By this way, users can get the detailed messages from cdc_stderr.log.
Check List
Tests
Release note