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

System-wide logging improvements #1170

Open
kralicky opened this issue Mar 11, 2023 · 1 comment
Open

System-wide logging improvements #1170

kralicky opened this issue Mar 11, 2023 · 1 comment

Comments

@kralicky
Copy link
Member

The zap logger setup we have has been working well so far, but as the project expands we should consider:
a) potential improvements, refactors, or redesigns of how we use loggers across places in the code
b) newer/better/standardized libraries to switch to

I've tried a few other logging libraries, and so far none seem to be as good as zap for our use cases, but more research is required.

slog (upcoming standard library structured logging)

  • It has a design similar to zap, and a good feature set and API
  • It is still very much in development, and lacks a lot of features that I like from zap (e.g. custom log output handlers)

zerolog

  • Inspired by/derived from zap, but with fewer options for customization. For this reason it probably isn't a good fit.
  • Performance improvements are very interesting though - I've noticed that zap is pretty heavy on memory allocations (although there are a lot of optimizations we can make in our own code).

Some issues we are running into currently:

  • Plugin logs are weird. I'm considering making a fork of go-plugin and swapping out hclog because the interoperability with zap is complicated
  • Sampling lacks important features such as logging the number of dropped logs. I've implemented this in my fork of zap which we use, but it's annoying to maintain.
@jan-law
Copy link
Contributor

jan-law commented Aug 10, 2023

As discussed earlier, noting some additional improvement suggestions

  • fetch agent plugin logs remotely instead of manually
  • send test log output to a file
  • I've kept the sampling behaviour the same as before. However, slog-sampling lets you configure the % rate of sampled logs for each log level (eg log 10% Info, 100% error and above). Suggestions welcome

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

No branches or pull requests

2 participants