diff --git a/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java b/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java index fa2b5af9..616a417c 100644 --- a/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java +++ b/pass-nihms-loader/nihms-data-harvest/src/main/java/org/eclipse/pass/loader/nihms/NihmsHarvesterCLIRunner.java @@ -23,6 +23,8 @@ import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @@ -34,6 +36,8 @@ @Component public class NihmsHarvesterCLIRunner implements CommandLineRunner { + private static final Logger LOG = LoggerFactory.getLogger(NihmsHarvesterCLIRunner.class); + /** * Request for help/usage documentation */ @@ -96,7 +100,6 @@ public void run(String... args) { /* Handle general options such as help, version */ if (this.help) { parser.printUsage(System.err); - System.err.println(); System.exit(0); } @@ -121,16 +124,10 @@ public void run(String... args) { nihmsHarvester.harvest(statusesToProcess, harvestPeriodMonths); } catch (CmdLineException e) { - /** - * This is an error in command line args, just print out usage data - * and description of the error. - */ - System.err.println(e.getMessage()); parser.printUsage(System.err); System.exit(1); } catch (Exception e) { - e.printStackTrace(); - System.err.println(e.getMessage()); + LOG.error("Error running Nihms Harvester", e); System.exit(1); } } diff --git a/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java b/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java index ef242c38..7ea2eb67 100644 --- a/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java +++ b/pass-nihms-loader/nihms-data-transform-load/src/main/java/org/eclipse/pass/loader/nihms/NihmsTransformLoadCLIRunner.java @@ -22,6 +22,8 @@ import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; import org.kohsuke.args4j.Option; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.boot.CommandLineRunner; import org.springframework.stereotype.Component; @@ -30,6 +32,9 @@ */ @Component public class NihmsTransformLoadCLIRunner implements CommandLineRunner { + + private static final Logger LOG = LoggerFactory.getLogger(NihmsTransformLoadCLIRunner.class); + /** * Request for help/usage documentation */ @@ -77,7 +82,6 @@ public void run(String... args) { /* Handle general options such as help, version */ if (this.help) { parser.printUsage(System.err); - System.err.println(); System.exit(0); } @@ -97,20 +101,11 @@ public void run(String... args) { nihmsTransformLoadService.transformAndLoadFiles(statusesToProcess); } catch (CmdLineException e) { - /** - * This is an error in command line args, just print out usage data - * and description of the error. - */ - System.err.println(e.getMessage()); parser.printUsage(System.err); - System.err.println(); System.exit(1); - } catch (Exception e) { - e.printStackTrace(); - System.err.println(e.getMessage()); + LOG.error("Error running Nihms Transform and Load", e); System.exit(1); - } } }