We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug After rotation (creation of a new file) the very first log line is skipped and is not showing in log file.
To Reproduce `func initiliaselogger() { level := getLevel(env.ENV.LOG_LEVEL)
devConfig := zap.NewDevelopmentEncoderConfig() prodConfig := zap.NewProductionEncoderConfig() devConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder prodConfig.EncodeTime = zapcore.RFC3339NanoTimeEncoder hostname, err := os.Hostname() if err != nil { hostname = "" } if hostname != "" { hostname = "_" + hostname } filewriter := zapcore.AddSync(&lumberjack.Logger{ Filename: "logs/regulatory/" + strings.ToLower(strings.ReplaceAll(env.ENV.PROCESS_NAME+hostname, " ", "_")) + ".log", MaxSize: 40, MaxAge: 30, MaxBackups: 100, Compress: false, // disabled by default }) core := zapcore.NewCore(zapcore.NewJSONEncoder(prodConfig), filewriter, level) if env.ENV.ENVIRONMENT == "dev" { core = zapcore.NewTee( core, zapcore.NewCore(zapcore.NewConsoleEncoder(devConfig), zapcore.Lock(os.Stdout), level), ) } if env.ENV.KAFKA_LOG == "Y" { kafkaSync := zapcore.AddSync(getKafkaWriter()) core = zapcore.NewTee( core, zapcore.NewCore(zapcore.NewJSONEncoder(prodConfig), kafkaSync, level), ) } Log = zap.New(core, zap.AddCaller(), zap.AddCallerSkip(1), zap.AddStacktrace(zap.ErrorLevel), )
}`
Expected behavior After the creation of a new file (after rotation), the very line of the log is skipped.
Pls let me know if I have to change anything in the configuration while initializing the logger.
The text was updated successfully, but these errors were encountered:
Hey @Akhilesh53,
Would you be able to provide a reproducible example that we can run and debug locally?
Sorry, something went wrong.
No branches or pull requests
Describe the bug
After rotation (creation of a new file) the very first log line is skipped and is not showing in log file.
To Reproduce
`func initiliaselogger() {
level := getLevel(env.ENV.LOG_LEVEL)
}`
Expected behavior
After the creation of a new file (after rotation), the very line of the log is skipped.
Pls let me know if I have to change anything in the configuration while initializing the logger.
The text was updated successfully, but these errors were encountered: