Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

log: support change the level of etcd for debugging #992

Merged
merged 2 commits into from
Sep 4, 2020

Conversation

GMHDBJD
Copy link
Collaborator

@GMHDBJD GMHDBJD commented Sep 4, 2020

What problem does this PR solve?

close #974

What is changed and how it works?

  • set etcd-log-level to warn if log-level is info, otherwise set it same as log-level

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    Manually check the log file.

Copy link
Collaborator

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest LGTM

logger := log.L().WithFields(zap.String("component", "embed etcd"))
// if logLevel is info, set etcd log level to WARN to reduce log
if strings.ToLower(logLevel) == "info" {
logger.Logger = logger.WithOptions(zap.IncreaseLevel(zap.WarnLevel))
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's log this change to tell user. and "debug" maybe a level lower than "info"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

add log in 6d12af4
user can use debug level to see more log about etcd.

logger.Logger = logger.WithOptions(zap.IncreaseLevel(zap.WarnLevel))
}

cfg.ZapLoggerBuilder = embed.NewZapCoreLoggerBuilder(logger.Logger, logger.Core(), log.Props().Syncer) // use global app props.
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure why change logger to logger.Logger

Copy link
Collaborator Author

@GMHDBJD GMHDBJD Sep 4, 2020

Choose a reason for hiding this comment

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

type of logger now is log.Logger after

logger := log.L().WithFields(zap.String("component", "embed etcd")).WithOptions(zap.IncreaseLevel(zap.ErrorLevel))
change. The type should be log.Logger.logger here.

@lance6716 lance6716 added needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 status/PTAL This PR is ready for review. Add this label back after committing new changes type/feature New feature labels Sep 4, 2020
@lance6716
Copy link
Collaborator

LGTM

@ti-srebot ti-srebot added the status/LGT1 One reviewer already commented LGTM label Sep 4, 2020
Copy link
Member

@csuzhangxc csuzhangxc left a comment

Choose a reason for hiding this comment

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

LGTM

@csuzhangxc csuzhangxc added status/LGT2 Two reviewers already commented LGTM, ready for merge and removed status/LGT1 One reviewer already commented LGTM status/PTAL This PR is ready for review. Add this label back after committing new changes labels Sep 4, 2020
@csuzhangxc csuzhangxc added this to the v2.0.0 RC.3 milestone Sep 4, 2020
@GMHDBJD GMHDBJD merged commit 420d210 into pingcap:master Sep 4, 2020
@GMHDBJD GMHDBJD deleted the etcdLogLevel branch September 4, 2020 13:02
@ti-srebot
Copy link

cherry pick to release-2.0 in PR #995

@ti-srebot ti-srebot added already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked and removed needs-cherry-pick-release-2.0 This PR should be cherry-picked to release-2.0. Remove this label after cherry-picked to release-2.0 labels Sep 4, 2020
csuzhangxc pushed a commit that referenced this pull request Sep 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
already-cherry-pick-2.0 The related PR is already cherry-picked to release-2.0. Add this label once the PR is cherry-picked status/LGT2 Two reviewers already commented LGTM, ready for merge type/feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support change the level of etcd for debugging
4 participants