From b6b45e714456b11bc58aecc2bdc6e5ac209bbf94 Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Fri, 14 Aug 2020 15:53:01 +0200 Subject: [PATCH] Logback configuration to lessen the debug noise. --- src/main/groovy/biz/nellemann/hmci/App.groovy | 15 +++++++++++++-- .../biz/nellemann/hmci/InfluxClient.groovy | 2 +- src/main/resources/logback.xml | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/logback.xml diff --git a/src/main/groovy/biz/nellemann/hmci/App.groovy b/src/main/groovy/biz/nellemann/hmci/App.groovy index 350568e..3ec8e4c 100644 --- a/src/main/groovy/biz/nellemann/hmci/App.groovy +++ b/src/main/groovy/biz/nellemann/hmci/App.groovy @@ -159,18 +159,29 @@ class App implements Runnable { OptionAccessor options = cli.parse(args) if (options.h) cli.usage() + if(options.v) { + // TODO - how to display correct version or build number ? + println("See https://bitbucket.org/mnellemann/hmci for more information.") + System.exit(0) + } + ConfigObject configuration if(options.c) { File configurationFile = new File((String)options.config) if(!configurationFile.exists()) { - println("No configuration file found at: " + configurationFile.toString()) + println("Error - No configuration file found at: " + configurationFile.toString()) System.exit(1) } configuration = new ConfigSlurper("development").parse(configurationFile.toURI().toURL()); } + if(configuration == null || configuration.isEmpty()) { + println("Error - Empty or faulty configuration") + System.exit(1) + } + new App(configuration) System.exit(0); } @@ -179,7 +190,7 @@ class App implements Runnable { @Override void run() { - log.info("run()") + log.debug("run()") boolean keepRunning = true int executions = 0 diff --git a/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy b/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy index 1e514b0..5135734 100644 --- a/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy +++ b/src/main/groovy/biz/nellemann/hmci/InfluxClient.groovy @@ -39,7 +39,7 @@ class InfluxClient { BatchOptions options = BatchOptions.DEFAULTS.actions(300).flushDuration(500); influxDB.enableBatch(options); - influxDB.setLogLevel(InfluxDB.LogLevel.BASIC); + //influxDB.setLogLevel(InfluxDB.LogLevel.BASIC); batchPoints = BatchPoints.database(database).precision(TimeUnit.SECONDS).build(); diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..feefcff --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,16 @@ + + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + + +