Fix redundant logs and add throwable print.
Change-Id: I401ac0ff7db3d951b0c6129f873a6f07fbd2a9eb
diff --git a/src/main/java/de/ids_mannheim/korap/init/NamedVCLoader.java b/src/main/java/de/ids_mannheim/korap/init/NamedVCLoader.java
index cbd9fb5..7bf7ccb 100644
--- a/src/main/java/de/ids_mannheim/korap/init/NamedVCLoader.java
+++ b/src/main/java/de/ids_mannheim/korap/init/NamedVCLoader.java
@@ -224,7 +224,12 @@
long start, end;
start = System.currentTimeMillis();
- VirtualCorpusCache.store(vcId, searchKrill.getIndex());
+ try {
+ VirtualCorpusCache.store(vcId, searchKrill.getIndex());
+ }
+ catch (Exception e) {
+ jlog.error("Failed caching vc "+vcId, e);
+ }
end = System.currentTimeMillis();
jlog.info("Duration : {}", (end - start));
config.setVcInCaching("");
@@ -239,13 +244,14 @@
private void storeVCinDB (String vcId, String koralQuery, QueryDO existingVC) {
try {
String info = (existingVC == null) ? "Storing" : "Updating";
- jlog.info("{} {} in database ", info, vcId);
+ jlog.info("{} {} in the database ", info, vcId);
vcService.storeQuery(existingVC, "system", vcId, ResourceType.SYSTEM,
QueryType.VIRTUAL_CORPUS, koralQuery, null, null, null,
true, "system", null, null);
}
- catch (KustvaktException e) {
+ catch (Exception e) {
+ jlog.error("Failed storing VC: "+vcId, e);
throw new RuntimeException(e);
}
}
diff --git a/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java b/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
index 8f7d80f..129cda2 100644
--- a/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
+++ b/src/main/java/de/ids_mannheim/korap/server/KustvaktServer.java
@@ -9,7 +9,7 @@
public class KustvaktServer extends KustvaktBaseServer {
public static void main (String[] args) throws Exception {
- System.setProperty("log4j.configurationFile", "data/log4j2.properties, log4j2.properties");
+ System.setProperty("log4j.configurationFile", "data/log4j2.properties");
KustvaktServer server = new KustvaktServer();
kargs = server.readAttributes(args);
diff --git a/src/main/resources/log4j2.properties b/src/main/resources/data/log4j2.properties
similarity index 98%
rename from src/main/resources/log4j2.properties
rename to src/main/resources/data/log4j2.properties
index 1201846..ed6307e 100644
--- a/src/main/resources/log4j2.properties
+++ b/src/main/resources/data/log4j2.properties
@@ -9,7 +9,7 @@
appender.file.name = MAINLOG
appender.file.fileName=./data/logs/kustvakt.log
appender.file.layout.type=PatternLayout
-appender.file.layout.pattern= %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n
+appender.file.layout.pattern= %d{yyyy-MM-dd, HH:mm:ss} %C{6} - %M%n %-5p: %m%n%xEx%n
appender.ldapFile.type = File
appender.ldapFile.name = LDAP_LOG