mirror of https://github.com/M66B/FairEmail.git
Added logging
This commit is contained in:
parent
cf03e9f94f
commit
02936de391
|
@ -246,6 +246,7 @@ class Core {
|
||||||
db.operation().deleteOperation(op.id);
|
db.operation().deleteOperation(op.id);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(context, folder.name + " " + Helper.formatThrowable(ex));
|
||||||
|
|
||||||
db.operation().setOperationError(op.id, Helper.formatThrowable(ex));
|
db.operation().setOperationError(op.id, Helper.formatThrowable(ex));
|
||||||
if (message != null && !(ex instanceof IllegalArgumentException))
|
if (message != null && !(ex instanceof IllegalArgumentException))
|
||||||
|
@ -1069,6 +1070,7 @@ class Core {
|
||||||
Log.w(folder.name, ex);
|
Log.w(folder.name, ex);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(context, folder.name + " " + Helper.formatThrowable(ex));
|
||||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -191,8 +191,11 @@ public class EntityRule {
|
||||||
} else
|
} else
|
||||||
matched = haystack.toLowerCase().contains(needle.trim().toLowerCase());
|
matched = haystack.toLowerCase().contains(needle.trim().toLowerCase());
|
||||||
|
|
||||||
EntityLog.log(context, "Rule=" + name + " matched=" + matched +
|
EntityLog.log(context, "Rule=" + name +
|
||||||
" needle=" + needle + " haystack=" + haystack + " regex=" + regex);
|
" matched=" + matched +
|
||||||
|
" needle=" + needle +
|
||||||
|
" haystack=" + haystack +
|
||||||
|
" regex=" + regex);
|
||||||
return matched;
|
return matched;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,9 @@ public class ServiceSend extends LifecycleService {
|
||||||
db.operation().deleteOperation(op.id);
|
db.operation().deleteOperation(op.id);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(outbox.name, ex);
|
Log.e(outbox.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSend.this,
|
||||||
|
outbox.name + " " + Helper.formatThrowable(ex));
|
||||||
|
|
||||||
db.operation().setOperationError(op.id, Helper.formatThrowable(ex));
|
db.operation().setOperationError(op.id, Helper.formatThrowable(ex));
|
||||||
if (message != null)
|
if (message != null)
|
||||||
|
@ -363,8 +366,9 @@ public class ServiceSend extends LifecycleService {
|
||||||
Address[] to = imessage.getAllRecipients();
|
Address[] to = imessage.getAllRecipients();
|
||||||
itransport.sendMessage(imessage, to);
|
itransport.sendMessage(imessage, to);
|
||||||
long time = new Date().getTime();
|
long time = new Date().getTime();
|
||||||
EntityLog.log(this, "Sent via " + ident.host + "/" + ident.user +
|
EntityLog.log(this,
|
||||||
" to " + TextUtils.join(", ", to));
|
"Sent via " + ident.host + "/" + ident.user +
|
||||||
|
" to " + TextUtils.join(", ", to));
|
||||||
|
|
||||||
// Append replied/forwarded text
|
// Append replied/forwarded text
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -429,6 +433,8 @@ public class ServiceSend extends LifecycleService {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityLog.log(this, ident.name + " last attempt: " + new Date(message.last_attempt));
|
||||||
|
|
||||||
long now = new Date().getTime();
|
long now = new Date().getTime();
|
||||||
long delayed = now - message.last_attempt;
|
long delayed = now - message.last_attempt;
|
||||||
if (delayed > IDENTITY_ERROR_AFTER * 60 * 1000L || ex instanceof SendFailedException) {
|
if (delayed > IDENTITY_ERROR_AFTER * 60 * 1000L || ex instanceof SendFailedException) {
|
||||||
|
|
|
@ -595,8 +595,12 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
else
|
else
|
||||||
try {
|
try {
|
||||||
wlFolder.acquire();
|
wlFolder.acquire();
|
||||||
|
|
||||||
String message = e.getMessage();
|
String message = e.getMessage();
|
||||||
Log.w(account.name + " alert: " + message);
|
Log.w(account.name + " alert: " + message);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this, account.name + " " +
|
||||||
|
Helper.formatThrowable(new Core.AlertException(message)));
|
||||||
db.account().setAccountError(account.id, message);
|
db.account().setAccountError(account.id, message);
|
||||||
|
|
||||||
if (message != null && !message.startsWith("Too many simultaneous connections")) {
|
if (message != null && !message.startsWith("Too many simultaneous connections")) {
|
||||||
|
@ -702,6 +706,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
// Report account connection error
|
// Report account connection error
|
||||||
if (account.last_connected != null && !ConnectionHelper.airplaneMode(this)) {
|
if (account.last_connected != null && !ConnectionHelper.airplaneMode(this)) {
|
||||||
EntityLog.log(this, account.name + " last connected: " + new Date(account.last_connected));
|
EntityLog.log(this, account.name + " last connected: " + new Date(account.last_connected));
|
||||||
|
|
||||||
long now = new Date().getTime();
|
long now = new Date().getTime();
|
||||||
long delayed = now - account.last_connected - account.poll_interval * 60 * 1000L;
|
long delayed = now - account.last_connected - account.poll_interval * 60 * 1000L;
|
||||||
if (delayed > ACCOUNT_ERROR_AFTER * 60 * 1000L && backoff > BACKOFF_ERROR_AFTER) {
|
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);
|
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
folder.name + " " + Helper.formatThrowable(ex));
|
||||||
state.error(ex);
|
state.error(ex);
|
||||||
} finally {
|
} finally {
|
||||||
wlMessage.release();
|
wlMessage.release();
|
||||||
|
@ -874,6 +882,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
folder.name + " " + Helper.formatThrowable(ex));
|
||||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||||
state.error(ex);
|
state.error(ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -925,6 +936,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
folder.name + " " + Helper.formatThrowable(ex));
|
||||||
state.error(ex);
|
state.error(ex);
|
||||||
} finally {
|
} finally {
|
||||||
wlMessage.release();
|
wlMessage.release();
|
||||||
|
@ -944,6 +958,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
}
|
}
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
folder.name + " " + Helper.formatThrowable(ex));
|
||||||
state.error(new FolderClosedException(ifolder, "IDLE"));
|
state.error(new FolderClosedException(ifolder, "IDLE"));
|
||||||
} finally {
|
} finally {
|
||||||
Log.i(folder.name + " end idle");
|
Log.i(folder.name + " end idle");
|
||||||
|
@ -1022,6 +1039,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
|
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(folder.name, ex);
|
Log.e(folder.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
folder.name + " " + Helper.formatThrowable(ex));
|
||||||
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
db.folder().setFolderError(folder.id, Helper.formatThrowable(ex));
|
||||||
state.error(ex);
|
state.error(ex);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1134,6 +1154,9 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
Log.w(ex);
|
Log.w(ex);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(account.name, ex);
|
Log.e(account.name, ex);
|
||||||
|
EntityLog.log(
|
||||||
|
ServiceSynchronize.this,
|
||||||
|
account.name + " " + Helper.formatThrowable(ex));
|
||||||
db.account().setAccountError(account.id, Helper.formatThrowable(ex));
|
db.account().setAccountError(account.id, Helper.formatThrowable(ex));
|
||||||
} finally {
|
} finally {
|
||||||
// Stop watching for operations
|
// Stop watching for operations
|
||||||
|
|
Loading…
Reference in New Issue