Repository: eagle
Updated Branches:
  refs/heads/master 31706c05a -> eaef3d6eb


[EAGLE-968] Fix for email issue in 0.5 eagle version

<!--
{% comment %}
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}
-->

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

 - [ ] Make sure the PR title is formatted like:
   `[EAGLE-<Jira issue #>] Description of pull request`
 - [ ] Make sure tests pass via `mvn clean verify`. (Even better, enable
       Travis-CI on your fork and ensure the whole test matrix passes).
 - [ ] Replace `<Jira issue #>` in the title with the actual Jira issue
       number, if there is one.
 - [ ] If this contribution is large, please file an Apache
       [Individual Contributor License 
Agreement](https://www.apache.org/licenses/icla.txt).

---

Author: kreddylh <kredd...@paypal.com>
Author: rushikesavareddy <kesha...@gmail.com>

Closes #941 from rushikesavareddy/branch-0.5.


Project: http://git-wip-us.apache.org/repos/asf/eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/eagle/commit/eaef3d6e
Tree: http://git-wip-us.apache.org/repos/asf/eagle/tree/eaef3d6e
Diff: http://git-wip-us.apache.org/repos/asf/eagle/diff/eaef3d6e

Branch: refs/heads/master
Commit: eaef3d6ebed34a37778e762ea40507c7490e0742
Parents: 31706c0
Author: kreddylh <kredd...@paypal.com>
Authored: Fri Feb 2 11:33:26 2018 -0800
Committer: Jay Sen <jsenjal...@paypal.com>
Committed: Fri Feb 2 11:33:26 2018 -0800

----------------------------------------------------------------------
 .../alert/engine/publisher/email/EagleMailClient.java  | 13 +++++++------
 .../org/apache/eagle/common/mail/EagleMailClient.java  | 11 ++++++-----
 2 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/eagle/blob/eaef3d6e/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/email/EagleMailClient.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/email/EagleMailClient.java
 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/email/EagleMailClient.java
index 7147894..c7e02e0 100755
--- 
a/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/email/EagleMailClient.java
+++ 
b/eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/email/EagleMailClient.java
@@ -25,7 +25,6 @@ import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import java.io.File;
 import java.io.StringWriter;
 import java.util.ArrayList;
@@ -39,9 +38,9 @@ import javax.mail.*;
 import javax.mail.internet.*;
 
 public class EagleMailClient {
+    
     private static final Logger LOG = 
LoggerFactory.getLogger(EagleMailClient.class);
     private static final String BASE_PATH = "templates/";
-
     private VelocityEngine velocityEngine;
     private Session session;
 
@@ -54,6 +53,8 @@ public class EagleMailClient {
             velocityEngine = new VelocityEngine();
             velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, 
"classpath");
             velocityEngine.setProperty("classpath.resource.loader.class", 
ClasspathResourceLoader.class.getName());
+            
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS,org.apache.velocity.runtime.log.Log4JLogChute.class.getName());
+            velocityEngine.setProperty("runtime.log.logsystem.log4j.logger", 
LOG.getName());
             velocityEngine.init();
 
             config.put("mail.transport.protocol", "smtp");
@@ -61,16 +62,16 @@ public class EagleMailClient {
                 session = Session.getInstance(config, new Authenticator() {
                     protected PasswordAuthentication 
getPasswordAuthentication() {
                         return new PasswordAuthentication(
-                            
config.getProperty(AlertEmailConstants.CONF_AUTH_USER),
-                            
config.getProperty(AlertEmailConstants.CONF_AUTH_PASSWORD)
-                        );
+                                
config.getProperty(AlertEmailConstants.CONF_AUTH_USER),
+                                
config.getProperty(AlertEmailConstants.CONF_AUTH_PASSWORD)
+                                );
                     }
                 });
             } else {
                 session = Session.getInstance(config, new Authenticator() {
                 });
             }
-
+            
             final String debugMode = 
config.getProperty(AlertEmailConstants.CONF_MAIL_DEBUG, "false");
             final boolean debug = Boolean.parseBoolean(debugMode);
             LOG.info("Set email debug mode: " + debugMode);

http://git-wip-us.apache.org/repos/asf/eagle/blob/eaef3d6e/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/mail/EagleMailClient.java
----------------------------------------------------------------------
diff --git 
a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/mail/EagleMailClient.java
 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/mail/EagleMailClient.java
index 81b1114..d15a60a 100644
--- 
a/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/mail/EagleMailClient.java
+++ 
b/eagle-core/eagle-common/src/main/java/org/apache/eagle/common/mail/EagleMailClient.java
@@ -24,7 +24,6 @@ import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
 import javax.activation.FileDataSource;
@@ -38,9 +37,9 @@ import java.util.Map;
 import java.util.Properties;
 
 public class EagleMailClient {
+    
     private static final Logger LOG = 
LoggerFactory.getLogger(EagleMailClient.class);
     private static final String BASE_PATH = "templates/";
-
     private VelocityEngine velocityEngine;
     private Session session;
 
@@ -53,6 +52,8 @@ public class EagleMailClient {
             velocityEngine = new VelocityEngine();
             velocityEngine.setProperty(RuntimeConstants.RESOURCE_LOADER, 
"classpath");
             velocityEngine.setProperty("classpath.resource.loader.class", 
ClasspathResourceLoader.class.getName());
+            
velocityEngine.setProperty(RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, 
org.apache.velocity.runtime.log.Log4JLogChute.class.getName());
+            velocityEngine.setProperty("runtime.log.logsystem.log4j.logger", 
LOG.getName());
             velocityEngine.init();
 
             config.put("mail.transport.protocol", "smtp");
@@ -60,9 +61,9 @@ public class EagleMailClient {
                 session = Session.getInstance(config, new Authenticator() {
                     protected PasswordAuthentication 
getPasswordAuthentication() {
                         return new PasswordAuthentication(
-                            
config.getProperty(AlertEmailConstants.CONF_AUTH_USER),
-                            
config.getProperty(AlertEmailConstants.CONF_AUTH_PASSWORD)
-                        );
+                                
config.getProperty(AlertEmailConstants.CONF_AUTH_USER),
+                                
config.getProperty(AlertEmailConstants.CONF_AUTH_PASSWORD)
+                                );
                     }
                 });
             } else {

Reply via email to