Log data for production applications


Did you consider discussing the use of BuildConfig.DEBUG or a replacement (given bugs in BuildConfig)?

For production applications the book’s discussion of logging is incomplete without this knowledge.


Before there was a buggy BuildConfig to use (viz. https://code.google.com/p/android/issues/detail?id=27940), I used a subclass of the Android Log class and included my own DEBUG flag, managed manually, as others elsewhere have suggested. I overrode various methods (d/i/v etc) from the superclass to check that flag first, and just used my own class everywhere instead of the framework version. This came in handy when the client had a requirement that the app save and upload all log data for debugging purposes, because I could still have it hidden from logcat but logged to its own file.


Excellent summary. Thanks brian.