tidb: Can't set the log level for tikv client caused by vendor

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

I’m working on tikv client benchmark.

But I realize that logrus.SetLevel() will not take effect caused by the vendor.

  1. What did you expect to see?

If here is any way for me to set the log level for tikv go client client.

...

import "github.com/Sirupsen/logrus"
...

func main() {

...
    logrus.SetLevel(logrus.ErrorLevel)
...

}
  1. What did you see instead?

nothing happened

  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

master branch

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 45 (17 by maintainers)

Most upvoted comments

@arthurkiller We don’t need a PR, the logutil.InitLogger function is already there, you can use it directly.

@arthurkiller You can try to add a function SetLogLevel in a package under tidb, then call that function in your benchmark code.

If you remove “sirupsen/logrus”, and reinstall it … You may find it actually works. I usually get into trouble with my computer, so I reboot it, it work!

$GOPATH/src/github.com/pingcap/tidb/cmd/benchraw 这个项目我直接 go build,执行没有 info log 输出

This case, Go use $GOPATH/src/github.com/pingcap/tidb/vendor/github.com/sirupsen to build the binary.

将, main.go copy 到 $GOPTAH/src/demo 下编译, 就会有 log 输出

In this case, Go use $GOPATH/src/github.com/sirupsen to build the binary.

go import is not case-sensitive

It’s Mac file system that case-insensitive, not Go.

sirupsen/logrus, not Sirupsen/logrus....
It's to better to remove Sirupsen/logrus directory
Upgrade your $GOPATH/src/github.com/pingcap/pd/pd-client to master, too.

It doesn’t work?

We provide vendor to get rid of user’s environment, and we use Makefile to control the build processing. If user break the rule, we can’t provide a repeatable build and it’s very hard to digest the problem.

sirupsen/logrus, not Sirupsen/logrus… It’s to better to remove Sirupsen/logrus directory Upgrade your $GOPATH/src/github.com/pingcap/pd/pd-client to master, too.

Try this one “github.com/sirupsen/logrus” ? @arthurkiller

So, show me the code or your repo, I can know what happened.

A suspicious place, you should

import "github.com/sirupsen/logrus"

not

import "github.com/Sirupsen/logrus"

Sorry, I don’t get the point. @arthurkiller What do you really want to do? what’s the log output do you expected? Is the output by your program or by the tikv client library? Would you please show me your program source code?