• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Log

xDiVx

Newbie
I have a few questions about the Log.
1)Is it "Bad Coding" if I don't use the log?
2)Why should I use it?
thanks a lot to whoever helps ^_^
 
The Log class should be used for debugging purposes only, and all regerences to the Log class should be removed at release time. If you dont wish to take advantage of tge Log class during debugging, then that's your choice.
 
I have a few questions about the Log.
1)Is it "Bad Coding" if I don't use the log?
2)Why should I use it?
thanks a lot to whoever helps ^_^

1) It is perfectly fine not to use logs. Developers use logs to verify expectations (or absence) (as mentioned by @jonbonazza for development and debug purpose), another way to do that is with assert. Tell you the truth, I consider logging expensive, though I know there is other camp that does not, which I totally respect. There is a price to pay when you log and debug (see #3 as counter argument).

2) In a complex code where different components interact with each other i.e. message passing with intents, broadcast, message handlers etc. Another typical situation is timer, async callback code is crooked to debug i.e. you could be waiting for every if your timer/callback logic incorrect, logs certainly help there.

3) A third point is that Log's should not be part of production code. You can setup a global constant LOGIT = true and check that before calling Log.x. Set it to false to skip logging in production app. Though I've not tried, but there seem to be ways to skip inclusion of log class (if you write a wrapper around android Log) and remove corresponding statements from the code automatically using frameworks such as maven, ant or proguard etc.
 
Back
Top Bottom