SQOOP-1727: Sqoop2: Log server initialization errors to log4j (Vinoth Chandar via Abraham Elmahrek)
Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/56a62e88 Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/56a62e88 Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/56a62e88 Branch: refs/heads/cdh5-1.99.4 Commit: 56a62e88be89ca6b135511b26689a17cabe74099 Parents: 589f1d7 Author: Abraham Elmahrek <[email protected]> Authored: Thu Nov 13 14:23:05 2014 -0800 Committer: Abraham Elmahrek <[email protected]> Committed: Wed Nov 19 13:44:27 2014 -0800 ---------------------------------------------------------------------- .../main/java/org/apache/sqoop/server/ServerInitializer.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/sqoop/blob/56a62e88/server/src/main/java/org/apache/sqoop/server/ServerInitializer.java ---------------------------------------------------------------------- diff --git a/server/src/main/java/org/apache/sqoop/server/ServerInitializer.java b/server/src/main/java/org/apache/sqoop/server/ServerInitializer.java index a150e3a..48963f3 100644 --- a/server/src/main/java/org/apache/sqoop/server/ServerInitializer.java +++ b/server/src/main/java/org/apache/sqoop/server/ServerInitializer.java @@ -17,6 +17,7 @@ */ package org.apache.sqoop.server; +import org.apache.log4j.Logger; import org.apache.sqoop.core.ConfigurationConstants; import org.apache.sqoop.core.SqoopServer; @@ -29,6 +30,8 @@ import javax.servlet.ServletContextListener; */ public class ServerInitializer implements ServletContextListener { + private static final Logger LOG = Logger.getLogger(ServerInitializer.class); + public void contextDestroyed(ServletContextEvent arg0) { SqoopServer.destroy(); } @@ -40,12 +43,11 @@ public class ServerInitializer implements ServletContextListener { // We are assuming that by default we are running as the only app inside // the tomcat and hence we want to try kill entire tomcat on our load failure. if("true".equals(System.getProperty(ConfigurationConstants.KILL_TOMCAT_ON_FAILURE, "true"))) { - System.out.println("Sqoop failed to load:"); - ex.printStackTrace(System.out); + LOG.error("Sqoop server failed to start", ex); System.exit(1); } - throw new RuntimeException("Sqoop server failed to load.", ex); + throw new RuntimeException("Sqoop server failed to start.", ex); } } }
