zeromicro / go-zero

A cloud-native Go microservices framework with cli tool for productivity.
https://go-zero.dev
MIT License
28.82k stars 3.91k forks source link

etcd context deadline exceeded #3705

Open ybrelax opened 10 months ago

ybrelax commented 10 months ago

Describe the bug 为什么在服务启动一段时间后就会不停的报这个错误? etcd 版本 etcd Version: 3.5.9

补充:

logx.DisableStat()
logx.SetLevel(logx.ErrorLevel)

我这样日志,为什么还能打印出来

错误情况

image

fynxiu commented 10 months ago

Thank you for bringing this issue to our attention. Based on your description, it seems that the logs you are encountering are being generated by the etcdclient used within the go-zero, and not by go-zero itself. This is an important distinction, as controlling the log output of the etcd client requires a different approach than controlling the logs of go-zero.

As of now, go-zero does not provide a built-in functionality to directly control the logging level of the etcd client. The logx.DisableStat() and logx.SetLevel(logx.ErrorLevel) calls that you mentioned are effective for go-zero's internal logging mechanism, but they won't impact the etcd client's logs.

The etcd client, by default, uses the zap logging framework. To control the etcd client’s logging behavior, you would need to configure the zap logger used by the etcd client. This can be a bit complex as it involves understanding and interfacing with the etcd client’s logging mechanism. Unfortunately, without direct support from go-zero to manipulate the etcd client's logger, this might require some custom handling on your part.

ybrelax commented 9 months ago

为什么在我本地启动etcd 不会报这个错误,我在服务器中用容器启动就会出现这个问题,当然etcd服务能正常访问,但是这个日志老是不停的弹出来。 image

Issues-translate-bot commented 9 months ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Why does this error not appear when I start etcd locally? This problem occurs when I start a container on the server. Of course, the etcd service can be accessed normally, but this log keeps popping up. image