Before releasing my Android app to the marketplace, should I comment out all logs?
Log.d(tag, "example of a log")
If I leave them there, will the app run slower?
A well-written logging code offers quick debugging, easy maintenance, and structured storage of an application's runtime information. Logging does have its drawbacks also. It can slow down an application as it uses some CPU cycles and other resources (memory, etc).
The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE.
The Logcat window in Android Studio displays system messages, such as when a garbage collection occurs, and messages that you added to your app with the Log class. It displays messages in real time and keeps a history so you can view older messages.
Logcat is a command-line tool that dumps a log of system messages, including stack traces when the device throws an error and messages that you have written from your app with the Log class. This page is about the command-line logcat tool, but you can also view log messages from the Logcat window in Android Studio.
Java doesn't support C#-style conditional compilation, so the parameters will always be evaluated. That includes any string concatenation and stuff you might be doing.
Short answer: yes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With