Removing Log Lines

Do you have any recommended ProGuard syntax to safely and efficiently remove all log lines?

I’ve been using this for some time:

# remove verbose logging
-assumenosideeffects class android.util.Log {
    public static *** v(...);
    public static *** d(...);
-assumenosideeffects class * implements org.slf4j.Logger {
    public *** trace(...);
    public *** debug(...);

I usually want to keep the log lines from anything above debug level.


Hi there,

To remove all logging code you should use

    -assumenosideeffects class android.util.Log {
    public static boolean isLoggable(java.lang.String, int);
    public static int v(...);
    public static int i(...);
    public static int w(...);
    public static int d(...);
    public static int e(...);
    public static java.lang.String

And for stack traces

-assumenosideeffects class java.lang.Exception {
public void printStackTrace();
1 Like