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

how to log to file? #426

Closed
MonsieurHorse opened this issue May 5, 2017 · 5 comments
Closed

how to log to file? #426

MonsieurHorse opened this issue May 5, 2017 · 5 comments
Labels

Comments

@MonsieurHorse
Copy link

this is an example, https://github.com/uber-go/zap/blob/747abfb0b3b130c9cf699e451f5aebfda379b5d1/example_test.go
but I can never imort NewJson method

what should I do?
thanks

@akshayjshah
Copy link
Contributor

The easiest way to do this is to create a zap.Config struct, which allows you to configure the paths you'd like to use for logging output.

@MonsieurHorse
Copy link
Author

thanks

@chmike
Copy link

chmike commented May 17, 2017

You may also consider using using funnel.

@DevashishX
Copy link

here is a better answer for Zap Logger output into a file

@aditya-opsverse
Copy link

aditya-opsverse commented Apr 4, 2022

Hey there!
If you want to write the log output to a file as well as the console/terminal, use this in zap.config;
OutputPaths: []string{"path_to_logfile", "stderr"},
This will write the logger output to the log file and to the terminal/console as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants