Commit 6712fd68 authored by Michael Menzel's avatar Michael Menzel

statfile fix for custom server

parent d90ceb11
...@@ -10,7 +10,7 @@ import java.nio.file.Path; ...@@ -10,7 +10,7 @@ import java.nio.file.Path;
public class Settings { public class Settings {
private static String contigsPath; private static String contigsPath;
private static String backendip; private static String backendip;
private static Path logfile; private static Path statpath;
private static Logger logger = LoggerFactory.getLogger(StatisticsCollector.class); private static Logger logger = LoggerFactory.getLogger(StatisticsCollector.class);
...@@ -32,12 +32,12 @@ public class Settings { ...@@ -32,12 +32,12 @@ public class Settings {
Settings.backendip = ip; Settings.backendip = ip;
} }
public static Path getLogfile_path() { public static Path getStatfile_path() {
return logfile; return statpath;
} }
public static void setLogfile_path(String logfile_path) { public static void setStatfile_path(String logfile_path) {
Settings.logfile = new File(logfile_path).toPath().toAbsolutePath(); Settings.statpath = new File(logfile_path).toPath().toAbsolutePath();
} }
public static String getContigsPath() { public static String getContigsPath() {
......
...@@ -23,7 +23,6 @@ import java.io.BufferedWriter; ...@@ -23,7 +23,6 @@ import java.io.BufferedWriter;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
...@@ -36,7 +35,7 @@ import java.util.stream.Stream; ...@@ -36,7 +35,7 @@ import java.util.stream.Stream;
*/ */
public final class StatisticsCollector { public final class StatisticsCollector {
private static final StatisticsCollector instance = new StatisticsCollector(Settings.getLogfile_path()); private static StatisticsCollector instance;
private final Path logPath; private final Path logPath;
private final Logger logger = LoggerFactory.getLogger(StatisticsCollector.class); private final Logger logger = LoggerFactory.getLogger(StatisticsCollector.class);
...@@ -99,7 +98,7 @@ public final class StatisticsCollector { ...@@ -99,7 +98,7 @@ public final class StatisticsCollector {
logPath.toFile().delete(); logPath.toFile().delete();
logger.error("Exception {}", "Corrupt log file", "The logfile was corrupt and was deleted. Please restart the server to enable logging again"); logger.error("Exception {}", "Corrupt log file", "The logfile was corrupt and was deleted. Please restart the server to enable logging again");
} catch (IOException | ParseException e) { } catch (Exception e) {
logger.error("Exception {}", e.getMessage(), e); logger.error("Exception {}", e.getMessage(), e);
} }
...@@ -107,6 +106,8 @@ public final class StatisticsCollector { ...@@ -107,6 +106,8 @@ public final class StatisticsCollector {
} }
public static StatisticsCollector getInstance() { public static StatisticsCollector getInstance() {
if (null == instance)
instance = new StatisticsCollector(Settings.getStatfile_path());
return instance; return instance;
} }
......
...@@ -38,11 +38,19 @@ public class Webinterface { ...@@ -38,11 +38,19 @@ public class Webinterface {
public static void main(String[] args) { public static void main(String[] args) {
if (args.length != 3) {
System.err.println("Incorrect number of arguments. Please specify the arguments according to the SETUPINSTR.md file.");
System.err.println("Exiting now");
System.exit(1);
}
/* Set up Settings */ /* Set up Settings */
Settings.setBackendip(args[0]); Settings.setBackendip(args[0]);
Settings.setContigsPath(args[1]); Settings.setContigsPath(args[1]);
Settings.setLogfile_path(args[2]); Settings.setStatfile_path(args[2]);
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment