Think about it: isLoggable ()
Checks if the log is logged for the specified tag at the specified level. By default, any tag is set to INFO. This means that any level above and including INFO will be registered. Before you make any calls to the logging method, you should check if the tag should be logged. You can change the default level by setting the system property: setprop log.tag.<YOUR_LOG_TAG> <LEVEL> Where the level is VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT or SUPPRESS. SUPPRESS will disable all entries for your tag. You can also create a local.prop file with the following in it: log.tag.<YOUR_LOG_TAG>=<LEVEL> and put it in /data/local.prop
Personally for releases, I delete debug logs and save error logs using Proguard.
Better wrap it like this:
public class MyLog { public static void d(String tag, String msg) { if (Log.isLoggable(tag, Log.DEBUG)) { Log.d(tag, msg); } } public static void i(String tag, String msg) { if (Log.isLoggable(tag, Log.INFO)) { Log.i(tag, msg); } }
You can set the logging level by issuing the adb command
Reno
source share