diff --git a/app/auth/main.go b/app/auth/main.go index 4bb04bd..ad6bcc8 100644 --- a/app/auth/main.go +++ b/app/auth/main.go @@ -4,16 +4,16 @@ import ( "net" "time" - consul "github.com/kitex-contrib/registry-consul" - "github.com/cloudwego/kitex/pkg/klog" "github.com/cloudwego/kitex/pkg/rpcinfo" "github.com/cloudwego/kitex/server" kitexlogrus "github.com/kitex-contrib/obs-opentelemetry/logging/logrus" + consul "github.com/kitex-contrib/registry-consul" "github.com/suyiiyii/hertz101/app/auth/conf" "github.com/suyiiyii/hertz101/app/auth/kitex_gen/auth/authservice" "go.uber.org/zap/zapcore" "gopkg.in/natefinch/lumberjack.v2" + "os" ) func main() { @@ -27,7 +27,6 @@ func main() { klog.Error(err.Error()) } } - func kitexInit() (opts []server.Option) { // address addr, err := net.ResolveTCPAddr("tcp", conf.GetConf().Kitex.Address) @@ -61,6 +60,7 @@ func kitexInit() (opts []server.Option) { FlushInterval: time.Minute, } klog.SetOutput(asyncWriter) + klog.SetOutput(os.Stdout) server.RegisterShutdownHook(func() { asyncWriter.Sync() }) diff --git a/app/facade/main.go b/app/facade/main.go index 2a89320..20160b7 100644 --- a/app/facade/main.go +++ b/app/facade/main.go @@ -4,6 +4,7 @@ package main import ( "context" + "os" "time" "github.com/cloudwego/hertz/pkg/app" @@ -59,6 +60,7 @@ func registerMiddleware(h *server.Hertz) { h.OnShutdown = append(h.OnShutdown, func(ctx context.Context) { asyncWriter.Sync() }) + hlog.SetOutput(os.Stdout) // pprof if conf.GetConf().Hertz.EnablePprof { diff --git a/app/user/main.go b/app/user/main.go index 1ed9dd7..c3a392c 100644 --- a/app/user/main.go +++ b/app/user/main.go @@ -6,6 +6,7 @@ import ( "github.com/suyiiyii/hertz101/app/user/biz/dal/query" "github.com/suyiiyii/hertz101/common/mtl" "net" + "os" "time" "github.com/cloudwego/kitex/pkg/klog" @@ -75,5 +76,6 @@ func kitexInit() (opts []server.Option) { server.RegisterShutdownHook(func() { asyncWriter.Sync() }) + klog.SetOutput(os.Stdout) return }