From 56fe5ffb08bc2ce57ca79f2e092cbf849717d8aa Mon Sep 17 00:00:00 2001 From: Koros Date: Fri, 25 Sep 2015 15:15:09 +0300 Subject: [PATCH 1/2] Configure smtp appender for the server --- assets/config/log4j.xml | 26 +++++++++++++++++++++++++- pom.xml | 8 ++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/assets/config/log4j.xml b/assets/config/log4j.xml index bc0a7b33e9..c21c26b079 100644 --- a/assets/config/log4j.xml +++ b/assets/config/log4j.xml @@ -41,6 +41,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -73,8 +96,9 @@ - + + diff --git a/pom.xml b/pom.xml index 3bcce698ea..5be3d80e8a 100644 --- a/pom.xml +++ b/pom.xml @@ -100,6 +100,14 @@ + + + javax.mail + mail + 1.4 + + + From 0feb215ad17c1ab6305f7fd725eb7a17ac528f48 Mon Sep 17 00:00:00 2001 From: Koros Date: Mon, 28 Sep 2015 09:51:53 +0300 Subject: [PATCH 2/2] Add logging statement to the catch block on FormSubmissionController.java --- .../src/main/java/org/opensrp/connector/HttpUtil.java | 5 +++++ .../org/opensrp/web/controller/FormSubmissionController.java | 1 + 2 files changed, 6 insertions(+) diff --git a/opensrp-connector/src/main/java/org/opensrp/connector/HttpUtil.java b/opensrp-connector/src/main/java/org/opensrp/connector/HttpUtil.java index d90d6cd123..39ebf5f2d1 100644 --- a/opensrp-connector/src/main/java/org/opensrp/connector/HttpUtil.java +++ b/opensrp-connector/src/main/java/org/opensrp/connector/HttpUtil.java @@ -12,6 +12,8 @@ import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.io.IOUtils; import org.opensrp.common.util.HttpResponse; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; @@ -24,6 +26,8 @@ @Component public class HttpUtil { + private static Logger logger = LoggerFactory.getLogger(HttpUtil.class.toString()); + public HttpUtil() { } @@ -52,6 +56,7 @@ public static HttpResponse post(String url, String payload, String data, String return new HttpResponse(con.getResponseCode() == HttpStatus.SC_OK, IOUtils.toString(con.getInputStream())); } catch (Exception e) { + logger.error(HttpUtil.class.toString(), e); throw new RuntimeException(e); } } diff --git a/opensrp-web/src/main/java/org/opensrp/web/controller/FormSubmissionController.java b/opensrp-web/src/main/java/org/opensrp/web/controller/FormSubmissionController.java index 5679d70618..2d09848caa 100644 --- a/opensrp-web/src/main/java/org/opensrp/web/controller/FormSubmissionController.java +++ b/opensrp-web/src/main/java/org/opensrp/web/controller/FormSubmissionController.java @@ -138,6 +138,7 @@ public FormSubmission convert(FormSubmissionDTO submission) { addFormToOpenMRS(formSubmission); } catch(Exception e){ + logger.error(this.getClass().getName(), e); e.printStackTrace(); ErrorTrace errorTrace=new ErrorTrace(new Date(), "Parse Exception", "", e.getStackTrace().toString(), "Unsolved", formSubmission.formName()); errorTrace.setRecordId(formSubmission.instanceId());