Update some error logging

Now it logs stack traces of exceptions, and does not use
exception.toString() as the format specifier, which can be
dangerous.

Change-Id: If841426067017c574c4aff88b8d8ae6b49ee867a
diff --git a/src/com/android/email/mail/store/ImapConnection.java b/src/com/android/email/mail/store/ImapConnection.java
index 9483475..cc61cf4 100644
--- a/src/com/android/email/mail/store/ImapConnection.java
+++ b/src/com/android/email/mail/store/ImapConnection.java
@@ -145,7 +145,7 @@
             mImapStore.ensurePrefixIsValid();
         } catch (SSLException e) {
             if (MailActivityEmail.DEBUG) {
-                LogUtils.d(Logging.LOG_TAG, e.toString());
+                LogUtils.d(Logging.LOG_TAG, e, "SSLException");
             }
             throw new CertificateValidationException(e.getMessage(), e);
         } catch (IOException ioe) {
@@ -153,7 +153,7 @@
             // of other code here that catches IOException and I don't want to break it.
             // This catch is only here to enhance logging of connection-time issues.
             if (MailActivityEmail.DEBUG) {
-                LogUtils.d(Logging.LOG_TAG, ioe.toString());
+                LogUtils.d(Logging.LOG_TAG, ioe, "IOException");
             }
             throw ioe;
         } finally {
@@ -390,7 +390,7 @@
             } catch (ImapException ie) {
                 // Log for debugging, but this is not a fatal problem.
                 if (MailActivityEmail.DEBUG) {
-                    LogUtils.d(Logging.LOG_TAG, ie.toString());
+                    LogUtils.d(Logging.LOG_TAG, ie, "ImapException");
                 }
             } catch (IOException ioe) {
                 // Special case to handle malformed OK responses and ignore them.
@@ -415,7 +415,7 @@
             } catch (ImapException ie) {
                 // Log for debugging, but this is not a fatal problem.
                 if (MailActivityEmail.DEBUG) {
-                    LogUtils.d(Logging.LOG_TAG, ie.toString());
+                    LogUtils.d(Logging.LOG_TAG, ie, "ImapException");
                 }
             } catch (IOException ioe) {
                 // Special case to handle malformed OK responses and ignore them.
@@ -446,7 +446,7 @@
             executeSimpleCommand(mLoginPhrase, true);
         } catch (ImapException ie) {
             if (MailActivityEmail.DEBUG) {
-                LogUtils.d(Logging.LOG_TAG, ie.toString());
+                LogUtils.d(Logging.LOG_TAG, ie, "ImapException");
             }
             throw new AuthenticationFailedException(ie.getAlertText(), ie);
 
@@ -470,7 +470,7 @@
             } catch (ImapException ie) {
                 // Log for debugging, but this is not a fatal problem.
                 if (MailActivityEmail.DEBUG) {
-                    LogUtils.d(Logging.LOG_TAG, ie.toString());
+                    LogUtils.d(Logging.LOG_TAG, ie, "ImapException");
                 }
             } catch (IOException ioe) {
                 // Special case to handle malformed OK responses and ignore them.