diff --git a/app/src/org/commcare/logging/AndroidLogger.java b/app/src/org/commcare/logging/AndroidLogger.java index 338648d52c..2b1d4ede21 100755 --- a/app/src/org/commcare/logging/AndroidLogger.java +++ b/app/src/org/commcare/logging/AndroidLogger.java @@ -82,4 +82,9 @@ public int logSize() { public void halt() { //Meh. } + + @Override + public void logException(Throwable e) { + CrashUtil.reportException(e); + } } diff --git a/app/src/org/commcare/logging/PreInitLogger.java b/app/src/org/commcare/logging/PreInitLogger.java index 40e485a525..2670f06354 100755 --- a/app/src/org/commcare/logging/PreInitLogger.java +++ b/app/src/org/commcare/logging/PreInitLogger.java @@ -1,6 +1,7 @@ package org.commcare.logging; import org.commcare.android.javarosa.AndroidLogEntry; +import org.commcare.utils.CrashUtil; import org.javarosa.core.api.ILogger; import org.javarosa.core.log.IFullLogSerializer; import org.javarosa.core.log.StreamLogSerializer; @@ -72,4 +73,9 @@ public int logSize() { public void halt() { // TODO Auto-generated method stub } + + @Override + public void logException(Throwable e) { + CrashUtil.reportException(e); + } } diff --git a/app/src/org/commcare/tasks/templates/CommCareTask.java b/app/src/org/commcare/tasks/templates/CommCareTask.java index 3bf2aebb9f..4f0998643d 100755 --- a/app/src/org/commcare/tasks/templates/CommCareTask.java +++ b/app/src/org/commcare/tasks/templates/CommCareTask.java @@ -39,17 +39,15 @@ protected final Result doInBackground(Params... params) { try { return doTaskBackground(params); } catch (Exception e) { - Logger.log(TAG, "Error during task execution: " + e.getMessage()); - e.printStackTrace(); - if (!(e instanceof UserCausedRuntimeException)) { // Report crashes we know weren't caused by user misconfiguration - CrashUtil.reportException(e); + Logger.exception("Error during task execution: ", e); + } else { + Logger.log(TAG, "Error during task execution: " + e.getMessage()); } // Save error for reporting during post-execute unknownError = e; - return null; } }