Skip to content

Commit

Permalink
TRUNK-6196: Email sending fails due to errors with velocity log conf… (
Browse files Browse the repository at this point in the history
  • Loading branch information
mseaton committed Oct 6, 2023
1 parent 6ef14e9 commit a367e73
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
package org.openmrs.notification.mail.velocity;

import java.io.StringWriter;
import java.util.Properties;

import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.log.Log4JLogChute;
import org.openmrs.notification.Message;
import org.openmrs.notification.MessageException;
import org.openmrs.notification.MessagePreparator;
Expand Down Expand Up @@ -40,7 +42,11 @@ public class VelocityMessagePreparator implements MessagePreparator {
public VelocityMessagePreparator() throws MessageException {
try {
engine = new VelocityEngine();
engine.init();
Properties props = new Properties();
props.put("runtime.log.logsystem.class", Log4JLogChute.class.getName());
props.put("runtime.log.logsystem.log4j.category", "velocity");
props.put("runtime.log.logsystem.log4j.logger", "velocity");
engine.init(props);
}
catch (Exception e) {
log.error("Failed to create velocity engine " + e.getMessage(), e);
Expand Down

0 comments on commit a367e73

Please sign in to comment.