Badger: Make Badger logging configurable

Created on 31 Aug 2018  路  9Comments  路  Source: dgraph-io/badger

Every time I open a database I see the following lines in the console. I can't find a setting to turn this debug information off.

2018/08/30 17:44:33 Replaying from value pointer: {Fid:0 Len:0 Offset:0}
2018/08/30 17:44:33 Iterating file id: 0
2018/08/30 17:44:33 Iteration took: 15.378碌s
kinmaintenance

Most helpful comment

Please use a logging library that does not impose its own flags on other programs. Badger should be able to be used embedded in another project without flag conflicts or flag bloat.

Maybe add an option to the Options struct to configure debug logging?

All 9 comments

Doesn't look like you can turn this off. This seems ... strange. Looking at the commit it appears it might be a temporary diagnostic.

It was put in place because some users were complaining that startup was taking a long time. Turned out it was because of the replay; so I added logging to make it obvious what's going on.

I could switch it to use glog library and set a higher verbose level to it, so it would be turned off by default.

Please use a logging library that does not impose its own flags on other programs. Badger should be able to be used embedded in another project without flag conflicts or flag bloat.

Maybe add an option to the Options struct to configure debug logging?

This new log output is interfering pretty badly with our go benchmark output.

Badger should have a configurable Debug field in Options (maybe a bool?). And DefaultOptions should have it set to false by default.

There are exceptions within the code base that you may want to log instead of error, and that's cool, but for the most part I think majority of users don't need the startup logging.

Starting to see about 400+ loc logged out for 500k entries every-time it's loaded.

We'll look into this. FWIW, https://github.com/dgraph-io/badger/commit/99233d725dbdd26d156c61b2f42ae1671b794656 removes the "Replaying log file" logs.

This PR disables all logging by default, using build tags to toggle - https://github.com/dgraph-io/badger/pull/605
Please test and let me know what you think.

Logger of Badger now can be disabled:

options := badger.DefaultOptions
options.Logger = nil
Was this page helpful?
0 / 5 - 0 ratings