Skip to content
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

Configuration file management app log confusion issues. #5798

Closed
0xMario27 opened this issue Apr 9, 2024 · 0 comments
Closed

Configuration file management app log confusion issues. #5798

0xMario27 opened this issue Apr 9, 2024 · 0 comments

Comments

@0xMario27
Copy link

What's going wrong?

Non-error logs will also be recorded in the error log file specified by the error_file in the configuration file when managing the app's logs.

How could we reproduce this issue?

Go demo code:

package main

import (
	"github.com/rs/zerolog"
	"github.com/rs/zerolog/log"
	"os"
)

func main() {
	zerolog.SetGlobalLevel(zerolog.DebugLevel)
	log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
	log.Info().Msg("This is an info message")
	log.Error().Msg("This is an error message")
}

pm2 configuration file:

// ecosystem.config.js
module.exports = {
    apps: [{
        name: "test_log",
        script: "./main",
        log_date_format: "YYYY-MM-DD",
        error_file: "./logs/error.log",
        out_file: "./logs/out.log",
    }]
}

error.log content:

2024-04-09: This is an info message
2024-04-09: This is an error message
2024-04-09: This is an info message
2024-04-09: This is an error message
...

out.log content:

The file content is empty.

Supporting information

# Run the following commands
$ pm2 start ecosystem.config.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant