cloudwego / hertz

Go HTTP framework with high-performance and strong-extensibility for building micro-services.
https://www.cloudwego.io
Apache License 2.0
5.12k stars 496 forks source link

There are no logs in the console after setting up SetLogger #1090

Closed xu756 closed 5 months ago

xu756 commented 5 months ago

Describe the Question

我配置hlog.SetLogger。日志全部输出到了文件,控制台没有了,我想文件 控制台都有 在官网没有找到相关设置 Reproducible Code

Screenshots

If applicable, add screenshots to help explain your question.

Hertz version:

0.7.3

Environment:

GO111MODULE='on'
GOARCH='arm64'
GOBIN=''
GOCACHE='/Users/xu756/Library/Caches/go-build'
GOENV='/Users/xu756/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/xu756/开发/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/xu756/开发/go'
GOPRIVATE=''
GOPROXY='https://goproxy.cn,direct'
GOROOT='/Users/xu756/devenv/go'
GOSUMDB='sum.golang.org'

Additional context 启动函数如下

var file = flag.String("f", "configs/dev.yaml", "config file path")

func main() {
    flag.Parse()
    config.Init(*file)
    log.Printf("【 WxappApi 】addr on %s", config.RunData.Addr.WxappApiAddr)
    hlog.SetLogger(xlog.InitHertzLog("wxapp"))
    hander.Init()
    router.InitRouter()
    err := router.HttpServer.Run()
    if err != nil {
        log.Fatalf("【 WxappApi 】run error: %v", err)
    }
}
github-actions[bot] commented 5 months ago

This issue has been marked as invalid question, please give more information by following the issue template. The issue will be closed in 1 days if no further activity occurs.

xu756 commented 5 months ago

I found a solution to this issue 769

li-jin-gou commented 5 months ago

Print to console performance is poor