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

*: clean up the logging component #23534

Merged
merged 16 commits into from
Jun 1, 2021

Conversation

SabaPing
Copy link
Contributor

@SabaPing SabaPing commented Mar 25, 2021

What problem does this PR solve?

Please refer to the meta issue for more information. #24190

The primary goal is to clean up the logging component. TiDB depends on two different third part log components, which are logrus and zap. This creates unnecessary complexity. In addition, there are some other logging flaws in code.

What is changed and how it works?

What's Changed:

  • Migrate logrus dependency to pingcap/log, which is based on zap.
  • Remove invalid log format console.
  • Cleanup gRPC debug log.

Outside users should not perceive relevant changes.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test

Release note

  • No release note.

@ti-srebot ti-srebot added the first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. label Mar 25, 2021
@ti-chi-bot ti-chi-bot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Mar 25, 2021
@SabaPing
Copy link
Contributor Author

SabaPing commented Mar 25, 2021

This is the first step for the task "Unify Log Framework".
After this pr being merged, I'll cleanup log code in pd, br and tidb-dashboard, one-by-one.
For more information, please read dev design here in Chinese.

@zz-jason
Copy link
Member

zz-jason commented Mar 27, 2021

@SabaPing thanks for your contribution, could you file a PR to discuss the proposal in the community?

Edit (2021/03/29): you can find the proposal template here: https://github.com/pingcap/tidb/blob/master/docs/design/TEMPLATE.md

@xhebox
Copy link
Contributor

xhebox commented Mar 27, 2021

/cc @xhebox @AilinKid

@SabaPing
Copy link
Contributor Author

@SabaPing thanks for your contribution, could you file a PR to discuss the proposal in the community?

Edit (2021/03/29): you can find the proposal template here: https://github.com/pingcap/tidb/blob/master/docs/design/TEMPLATE.md

Sure I'll finish the proposal in this week.

@breezewish breezewish added sig/diagnosis SIG: Diagnosis and removed sig/sql-infra SIG: SQL Infra labels Apr 2, 2021
@breezewish
Copy link
Member

@SabaPing thanks for your contribution, could you file a PR to discuss the proposal in the community?
Edit (2021/03/29): you can find the proposal template here: https://github.com/pingcap/tidb/blob/master/docs/design/TEMPLATE.md

Sure I'll finish the proposal in this week.

I think you can just post your doc in the sig channel. However remember to make it public. @SabaPing

@github-actions github-actions bot added the sig/sql-infra SIG: SQL Infra label Apr 2, 2021
@crazycs520
Copy link
Contributor

@AilinKid @tangenta PTAL

go.mod Show resolved Hide resolved
Copy link
Contributor

@crazycs520 crazycs520 left a comment

Choose a reason for hiding this comment

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

/LGTM

Copy link
Contributor

@xhebox xhebox 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 the status/LGT1 Indicates that a PR has LGTM 1. label Apr 9, 2021
@xhebox
Copy link
Contributor

xhebox commented Apr 9, 2021

/merge

@ti-chi-bot
Copy link
Member

@xhebox: /merge in this pull request requires 2 /lgtm.

In response to this:

/merge

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@AilinKid
Copy link
Contributor

AilinKid commented Apr 9, 2021

/LGTM

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • AilinKid
  • xhebox

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 writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot removed the status/LGT1 Indicates that a PR has LGTM 1. label Apr 9, 2021
@ti-chi-bot ti-chi-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 21, 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 May 29, 2021
@xhebox
Copy link
Contributor

xhebox commented May 31, 2021

@SabaPing Rabase plz? I think we can merge the PR now.

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

@SabaPing Rabase plz? I think we can merge the PR now.

Done rebased

@xhebox
Copy link
Contributor

xhebox commented May 31, 2021

/merge

@ti-chi-bot
Copy link
Member

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

Commit hash: 7c7cde3

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

xhebox commented Jun 1, 2021

/merge

@ti-chi-bot ti-chi-bot merged commit bbd5b32 into pingcap:master Jun 1, 2021
if len(os.Getenv("GRPC_DEBUG")) > 0 {
grpclog.SetLoggerV2(grpclog.NewLoggerV2WithVerbosity(os.Stderr, os.Stderr, os.Stderr, 999))
} else {
grpclog.SetLoggerV2(grpclog.NewLoggerV2(io.Discard, io.Discard, 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.

The bug comes from previously we just Discard these logs @SabaPing

var SlowQueryZapLogger = zaplog.L()

// InitLogger initializes PD's logger.
// InitLogger delegates to InitZapLogger. Keeping it here for historical reason.
func InitLogger(cfg *LogConfig) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

PD still depend on this method, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

If so, why not we retain InitLogger and drop InitZapLogger? An interface is better to be more abstract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/config first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. sig/diagnosis SIG: Diagnosis sig/sql-infra SIG: SQL Infra size/XXL Denotes a PR that changes 1000+ 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.