In this code style they said that we shouldn't use System.out.println() but I don't understand their's idea. can Anyone explain about that? What should I use to trace the log of my app?
System.out.println() (or printf() for native code) should never be used. System.out and System.err get redirected to /dev/null, so your print statements will have no visible effects. However, all the string building that happens for these calls still gets executed.
It was my problem too. You should use class methods of Log.
As android developer, these are the commonly used method of Logging utility
Log.wtf()- What a Terrible Failure: Report an exception that should
Methods above have both parameters :
String , String- This is a basic parameter which is a TAG and Message.
String, String, Throwable- Has similarity on first one. However, If you want to log an
Throwables in logcat, other than calling
EDIT: Going straight to answer your question.
System.err will still displayed in logcat, but with limitations.
You can't define your own
TAG, it will display
System.out with your text. As equivalence
System.out.println("Hello!")is equivalent to
System.err.println("Hello!")is equivalent to