go-zero icon indicating copy to clipboard operation
go-zero copied to clipboard

when log mode config file or volume ,the program print to console

Open sdhczw opened this issue 3 years ago • 3 comments
trafficstars

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior, if applicable:

  1. The code is

    package main
    import (
     "bookstore/api/internal/config"
     "bookstore/api/internal/handler"
     "bookstore/api/internal/svc"
     "flag"
     "fmt"
     "github.com/zeromicro/go-zero/core/logx"
    
     "github.com/zeromicro/go-zero/core/conf"
     "github.com/zeromicro/go-zero/rest"
      )
    
      var configFile = flag.String("f", "etc/bookstore-api.yaml", "the config file")
    
      func main() {
     flag.Parse()
    
     var c config.Config
     conf.MustLoad(*configFile, &c)
     logx.Info("before logx =======")
     ctx := svc.NewServiceContext(c)
     server := rest.MustNewServer(c.RestConf)
     defer server.Stop()
    
     handler.RegisterHandlers(server, ctx)
     logx.Info("after logx =======")
     fmt.Printf("Starting server at %s:%d...\n", c.Host, c.Port)
     server.Start()
      }
    
    

Name: bookstore-api
Host: 0.0.0.0
Port: 8888
MaxConns: 10000
Timeout: 10000 #ms
MaxBytes: 104857600
Log:
  Mode: file 
  Path: ../testdata/logs
  Level: info
  Compress: false
  KeepDays: 7

  1. The error is

     when config logs mode is file or volume ,"after logx =======" not print  into file 
    

Expected behavior logs print into file not to console

Screenshots If applicable, add screenshots to help explain your problem.

Environments (please complete the following information):

gozero 1.3.5

More description Add any other context about the problem here.

sdhczw avatar Aug 12 '22 08:08 sdhczw

Please try it in v1.4.0

kevwan avatar Aug 12 '22 14:08 kevwan

v1.4.0 is ok

sdhczw avatar Oct 08 '22 04:10 sdhczw

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Mar 17 '24 01:03 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar Jun 19 '24 01:06 github-actions[bot]