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

*: start replacing logger with zap logger #9279

Merged
merged 7 commits into from
Feb 15, 2019
Merged

Conversation

zimulala
Copy link
Contributor

@zimulala zimulala commented Feb 12, 2019

What problem does this PR solve?

Start replacing with zap logger.
Rely on pingcap/log#2
Relate to pingcap/tidb-test#733

What is changed and how it works?

Replace logger with the global logger pingcap/log.
And support Unified Log Format.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change

Related changes

  • Need to cherry-pick to the release branch

@zimulala
Copy link
Contributor Author

/run-all-tests

@zz-jason zz-jason added type/enhancement The issue or PR belongs to an enhancement. component/server and removed CHANGELOG labels Feb 12, 2019
@zimulala
Copy link
Contributor Author

/run-integration-ddl-test tidb-test=pr/733

@zimulala
Copy link
Contributor Author

PTAL @tiancaiamao @jackysp @lysu

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@zimulala zimulala added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 12, 2019
go.mod Outdated
@@ -48,11 +48,11 @@ require (
github.com/pingcap/gofail v0.0.0-20181217135706-6a951c1e42c3
github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e
github.com/pingcap/kvproto v0.0.0-20190110035000-d4fe6b336379
github.com/pingcap/log v0.0.0-20190129103703-6afc545b8868
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the log is both replaced and updated ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this PR need to add the pingcap/log, but now we use pingcap/log#2 to replace pingcap/log. After the pingcap/log#2 merging, I will remove line90.

util/logutil/log_test.go Outdated Show resolved Hide resolved
@zimulala
Copy link
Contributor Author

PTAL @tiancaiamao

tidb-server/main.go Outdated Show resolved Hide resolved
@@ -250,13 +263,16 @@ func initFileLog(cfg *FileLogConfig, logger *log.Logger) error {
// SlowQueryLogger is used to log slow query, InitLogger will modify it according to config file.
var SlowQueryLogger = log.StandardLogger()

// SlowQueryZapLogger is used to log slow query, InitZapLogger will set it according to config file.
var SlowQueryZapLogger *zap.Logger
Copy link
Member

Choose a reason for hiding this comment

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

should we remove SlowQueryLogger?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. But not now.
After we replace SlowQueryLogger with SlowQueryZapLogger, we can remove it.

tidb-server/main.go Outdated Show resolved Hide resolved
@zimulala
Copy link
Contributor Author

PTAL @zz-jason @winoros

go.mod Show resolved Hide resolved
@zz-jason
Copy link
Member

@zimulala please merge master and resolve conflicts.

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

config/config.go Show resolved Hide resolved
tidb-server/main.go Outdated Show resolved Hide resolved
tidb-server/main.go Show resolved Hide resolved
@lysu
Copy link
Contributor

lysu commented Feb 15, 2019

LGTM

@zimulala zimulala added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 15, 2019
@codecov-io
Copy link

Codecov Report

Merging #9279 into master will increase coverage by <.01%.
The diff coverage is 67.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9279      +/-   ##
==========================================
+ Coverage    67.2%   67.21%   +<.01%     
==========================================
  Files         371      371              
  Lines       77511    77552      +41     
==========================================
+ Hits        52094    52123      +29     
- Misses      20767    20772       +5     
- Partials     4650     4657       +7
Impacted Files Coverage Δ
config/config.go 16% <0%> (+1.45%) ⬆️
server/http_handler.go 36.88% <25%> (-0.06%) ⬇️
util/logutil/log.go 64.8% <72.72%> (+1.3%) ⬆️
util/systimemon/systime_mon.go 80% <0%> (-20%) ⬇️
executor/index_lookup_join.go 77.28% <0%> (-0.64%) ⬇️
store/tikv/gcworker/gc_worker.go 41.57% <0%> (+0.42%) ⬆️
expression/schema.go 94.53% <0%> (+0.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9c7c70...6ebfc0a. Read the comment docs.

@XuHuaiyu XuHuaiyu changed the title *: Start replacing logger with zap logger *: start replacing logger with zap logger Feb 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/LGT2 Indicates that a PR has LGTM 2. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants