IDEMPIERE-2771 Improve 2pack tracing for errors / add servername to the subject email

This commit is contained in:
Carlos Ruiz 2016-12-08 00:03:57 +01:00
parent 9499cb0df4
commit ec8c0ea178
1 changed files with 10 additions and 1 deletions

View File

@ -25,6 +25,8 @@
package org.adempiere.pipo2; package org.adempiere.pipo2;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
@ -34,6 +36,7 @@ import org.compiere.model.MSysConfig;
import org.compiere.util.EMail; import org.compiere.util.EMail;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.WebUtil;
/** /**
* PackIn Notifier * PackIn Notifier
@ -105,7 +108,13 @@ public class PackInNotifier {
} else { } else {
status = "Failure"; status = "Failure";
} }
subject.append(status).append("* Result for PackIn ").append(getFileName()); String serverName = null;
try {
serverName = InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
serverName = WebUtil.getHostIP();
}
subject.append(status).append("* ").append(serverName).append(" - Result for PackIn ").append(getFileName());
if (getPluginName() != null) { if (getPluginName() != null) {
subject.append(" from ").append(getPluginName()); subject.append(" from ").append(getPluginName());
} }