2012年3月25日 星期日

[Android] Log

The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE.
  • Verbose should never be compiled into an application except during development.
  • Debug logs are compiled in but stripped at runtime.
  • Error, warning and info logs are always kept.

  • When you're building the string to pass into Log.d, the compiler uses a StringBuilder and at least three allocations occur: 
    • the StringBuilder itself
    • the buffer
    • the String object.
    • Realistically, there is also another buffer allocation and copy, and even more pressure on the gc.
  • That means that if your log message is filtered out, you might be doing significant work and incurring significant overhead.



* Reference
- Log | Android Developers

沒有留言:

張貼留言