-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
fix(servicegroup): use logx for shutdown message #3719
Conversation
Here, we cannot guarantee that logx is still available, it might be closed already. |
@kevwan Thanks for the feedback, what's the expected behaviour when I also can't seem to force an issue by manually closing logx.Close()
logx.Info("Foo") Ideally I'd like my service logs to all be the same format (json) to keep parsing/shipping easier. Let me know what you think? |
If logx is closed already, logs are printed to console. You can try it with the following code. package main
import (
"time"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/logx"
)
func main() {
var c logx.LogConf
if err := conf.FillDefault(&c); err != nil {
panic(err)
}
c.Mode = "file"
logx.MustSetup(c)
logx.Info("hello")
logx.Close()
time.Sleep(time.Second)
logx.Info("world")
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Currently when stopping a service in a
ServiceGroup
the standard logger is used, this changes the log line to use thelogx
package and ensure all log lines are of the same format.