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

ticdc/server: output the cdc server cmd error to stderr #3520

Merged
merged 24 commits into from
Nov 29, 2021

Conversation

zhaoxinyu
Copy link
Contributor

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

  • Unit test
  • Integration test

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Nov 18, 2021

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • 3AceShowHand
  • hi-rustin

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note-none Denotes a PR that doesn't merit a release note. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 18, 2021
@zhaoxinyu zhaoxinyu changed the title cdc/server: output the cdc server cmd error to stderr ticdc/server: output the cdc server cmd error to stderr Nov 18, 2021
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 18, 2021
pkg/cmd/cmd.go Outdated
// Outputs cmd.Print to stdout.
cmd.SetOut(os.Stdout)
// Outputs cmd.Print to stderr.
cmd.SetOut(os.Stderr)
Copy link
Member

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

Copy link
Contributor Author

@zhaoxinyu zhaoxinyu Nov 18, 2021

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.

Copy link
Contributor Author

@zhaoxinyu zhaoxinyu Nov 18, 2021

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.

Copy link
Member

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.

@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 19, 2021
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 19, 2021
Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

LGTM.

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 22, 2021
@Rustin170506
Copy link
Member

@zhaoxinyu Could you please resolve the conflicting? Thanks!

@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 22, 2021
@zhaoxinyu
Copy link
Contributor Author

@hi-rustin, conflicts resolved.

@overvenus
Copy link
Member

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: f367857

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 23, 2021
@Ehco1996
Copy link
Contributor

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: c67ff9d

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Nov 29, 2021
@ti-chi-bot ti-chi-bot merged commit 5e218c7 into pingcap:master Nov 29, 2021
okJiang pushed a commit to okJiang/tiflow that referenced this pull request Dec 8, 2021
@overvenus overvenus added needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. labels Dec 14, 2021
@overvenus
Copy link
Member

/run-cherry-picker

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 14, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3872.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 14, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3873.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 14, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3874.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 14, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3875.

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 14, 2021
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created: #3876.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-cherry-pick-release-4.0 Should cherry pick this PR to release-4.0 branch. needs-cherry-pick-release-5.0 Should cherry pick this PR to release-5.0 branch. needs-cherry-pick-release-5.1 Should cherry pick this PR to release-5.1 branch. needs-cherry-pick-release-5.2 Should cherry pick this PR to release-5.2 branch. needs-cherry-pick-release-5.3 Should cherry pick this PR to release-5.3 branch. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants