mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Added logging
This commit is contained in:
@@ -595,8 +595,12 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
else
|
||||
try {
|
||||
wlFolder.acquire();
|
||||
|
||||
String message = e.getMessage();
|
||||
Log.w(account.name + " alert: " + message);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this, account.name + " " +
|
||||
Helper.formatThrowable(new Core.AlertException(message)));
|
||||
db.account().setAccountError(account.id, message);
|
||||
|
||||
if (message != null && !message.startsWith("Too many simultaneous connections")) {
|
||||
@@ -702,6 +706,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
// Report account connection error
|
||||
if (account.last_connected != null && !ConnectionHelper.airplaneMode(this)) {
|
||||
EntityLog.log(this, account.name + " last connected: " + new Date(account.last_connected));
|
||||
|
||||
long now = new Date().getTime();
|
||||
long delayed = now - account.last_connected - account.poll_interval * 60 * 1000L;
|
||||
if (delayed > ACCOUNT_ERROR_AFTER * 60 * 1000L && backoff > BACKOFF_ERROR_AFTER) {
|
||||
@@ -846,6 +851,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
folder.name + " " + Helper.formatThrowable(ex));
|
||||
state.error(ex);
|
||||
} finally {
|
||||
wlMessage.release();
|
||||
@@ -874,6 +882,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
folder.name + " " + Helper.formatThrowable(ex));
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
state.error(ex);
|
||||
} finally {
|
||||
@@ -925,6 +936,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
folder.name + " " + Helper.formatThrowable(ex));
|
||||
state.error(ex);
|
||||
} finally {
|
||||
wlMessage.release();
|
||||
@@ -944,6 +958,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
folder.name + " " + Helper.formatThrowable(ex));
|
||||
state.error(new FolderClosedException(ifolder, "IDLE"));
|
||||
} finally {
|
||||
Log.i(folder.name + " end idle");
|
||||
@@ -1022,6 +1039,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
|
||||
} catch (Throwable ex) {
|
||||
Log.e(folder.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
folder.name + " " + Helper.formatThrowable(ex));
|
||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||
state.error(ex);
|
||||
} finally {
|
||||
@@ -1134,6 +1154,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
Log.w(ex);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(account.name, ex);
|
||||
EntityLog.log(
|
||||
ServiceSynchronize.this,
|
||||
account.name + " " + Helper.formatThrowable(ex));
|
||||
db.account().setAccountError(account.id, Helper.formatThrowable(ex));
|
||||
} finally {
|
||||
// Stop watching for operations
|
||||
|
||||
Reference in New Issue
Block a user