migrated error logs to my implementation
This commit is contained in:
parent
ec6e9e35d3
commit
8b3a48da10
10 changed files with 54 additions and 46 deletions
|
@ -40,10 +40,10 @@ public class Main {
|
|||
if ((mongoDBHandler.getDatabase().getCollection(MongoPprUtils.SPEECH_COLLECTION_NAME).countDocuments() != 0) && !FORCE_UPLOAD_SPEECHES) {
|
||||
Logger.info("Skipping Speech parsing and DB insertion as they are already present...");
|
||||
} else {
|
||||
Logger.pink("Deleting all speeches from DB if existing...");
|
||||
Logger.warn("Deleting all speeches from DB if existing...");
|
||||
mongoDBHandler.deleteSpeechRelatedDocuments();
|
||||
|
||||
Logger.pink("Parsing XML and inserting data into DB (Uebung 2)...");
|
||||
Logger.pink("Parsing XML and inserting data into DB...");
|
||||
SpeechIndex speechIndex = speechIndexFactory
|
||||
.parseLegislativePeriods(TRUE)
|
||||
.builder()
|
||||
|
@ -53,10 +53,10 @@ public class Main {
|
|||
|
||||
//speechIndex.printInfo();
|
||||
|
||||
System.out.println("Data retrieved from DB:");
|
||||
System.out.println("SPEECHCOUNT: " + speechIndex.getSpeeches().size());
|
||||
System.out.println("SESSIONCOUNT: " + speechIndex.getSessions().size());
|
||||
System.out.println("AGENDAITEMCOUNT: " + speechIndex.getAgendaItems().size());
|
||||
Logger.info("Data retrieved from DB:");
|
||||
Logger.info("SPEECHCOUNT: " + speechIndex.getSpeeches().size());
|
||||
Logger.info("SESSIONCOUNT: " + speechIndex.getSessions().size());
|
||||
Logger.info("AGENDAITEMCOUNT: " + speechIndex.getAgendaItems().size());
|
||||
|
||||
mongoDBHandler.deleteSpeechRelatedDocuments(); // Clear speeches, sessions, agendas (history)
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class Main {
|
|||
extractor.extractAndUploadXmiData();
|
||||
|
||||
long endTime = System.currentTimeMillis();
|
||||
System.out.println("Execution time: " + (endTime - startTime) + " ms");
|
||||
Logger.pink("Execution time: " + (endTime - startTime) + " ms");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import org.texttechnologylab.project.gruppe_05_1.domain.html.ParlamentarierDetai
|
|||
import org.texttechnologylab.project.gruppe_05_1.domain.speaker.Membership;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.speech.SpeechMetaData;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
@ -130,7 +131,7 @@ public class MongoPprUtils {
|
|||
plist.add(p);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
System.err.print(t);
|
||||
Logger.error(String.valueOf(t));
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.texttechnologylab.DockerUnifiedUIMAInterface.lua.DUUILuaContext;
|
|||
import org.texttechnologylab.annotation.NamedEntity;
|
||||
import org.texttechnologylab.project.gruppe_05_1.database.MongoDBHandler;
|
||||
import org.texttechnologylab.project.gruppe_05_1.database.domainimp.speeches.Speech_MongoDB_Impl;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Content;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.Speech;
|
||||
import org.texttechnologylab.uima.type.Sentiment;
|
||||
|
@ -65,8 +66,8 @@ public class NlpUtils {
|
|||
try {
|
||||
runVideos();
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("Exception: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -83,8 +84,8 @@ public class NlpUtils {
|
|||
try {
|
||||
ctx = new DUUILuaContext().withJsonLibrary();
|
||||
} catch (IOException e) {
|
||||
System.err.println("IOException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("IOException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -94,8 +95,8 @@ public class NlpUtils {
|
|||
.withLuaContext(ctx) // wir setzen den definierten Kontext
|
||||
.withWorkers(iWorkers); // wir geben dem Composer eine Anzahl an Threads mit.
|
||||
} catch (URISyntaxException e) {
|
||||
System.err.println("URISyntaxException: " + e.getMessage());
|
||||
System.err.println(e.getMessage());
|
||||
Logger.error("URISyntaxException: " + e.getMessage());
|
||||
Logger.error(e.getMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -105,16 +106,16 @@ public class NlpUtils {
|
|||
try {
|
||||
dockerDriver = new DUUIDockerDriver();
|
||||
} catch (IOException e) {
|
||||
System.err.println("IOException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("IOException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
} catch (UIMAException e) {
|
||||
System.err.println("UIMAException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("UIMAException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
} catch (SAXException e) {
|
||||
System.err.println("SAXException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("SAXException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -134,12 +135,12 @@ public class NlpUtils {
|
|||
try {
|
||||
pCas = JCasFactory.createText("Ich finde dieses Programm läuft sehr gut. Ich überlege wie ich dieses für meine Bachelor-Arbeit nachnutzen kann.", "de");
|
||||
} catch (ResourceInitializationException e) {
|
||||
System.err.println("ResourceInitializationException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("ResourceInitializationException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
} catch (CASException e) {
|
||||
System.err.println("CASException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("CASException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -165,8 +166,8 @@ public class NlpUtils {
|
|||
.withScale(iWorkers)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("Exception: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -177,8 +178,8 @@ public class NlpUtils {
|
|||
.withScale(iWorkers)
|
||||
.build());
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("Exception: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -187,8 +188,8 @@ public class NlpUtils {
|
|||
try {
|
||||
pComposer.run(tCas);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Exception: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("Exception: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
@ -203,12 +204,12 @@ public class NlpUtils {
|
|||
try {
|
||||
jcas = JCasFactory.createJCas();
|
||||
} catch (ResourceInitializationException e) {
|
||||
System.err.println("ResourceInitializationException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("ResourceInitializationException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
} catch (CASException e) {
|
||||
System.err.println("CASException: " + e.getMessage());
|
||||
System.err.println(Arrays.toString(e.getStackTrace()));
|
||||
Logger.error("CASException: " + e.getMessage());
|
||||
Logger.error(Arrays.toString(e.getStackTrace()));
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.texttechnologylab.project.gruppe_05_1.rest;
|
||||
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.PropertiesUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -29,12 +30,12 @@ public class JavalinConfig extends Properties {
|
|||
|
||||
try (InputStream input = PropertiesUtils.class.getClassLoader().getResourceAsStream(propertiesFileName)) {
|
||||
if (null == input) {
|
||||
System.err.println("Properties-Datei '" + propertiesFileName + "' konnte nicht gelesen werden");
|
||||
Logger.error("Properties-Datei '" + propertiesFileName + "' konnte nicht gelesen werden");
|
||||
}
|
||||
|
||||
this.load(input);
|
||||
} catch (IOException ioex) {
|
||||
System.err.println("Exception beim Lesen der properties-Datei '" + propertiesFileName + "': " + ioex.getLocalizedMessage());
|
||||
Logger.error("Exception beim Lesen der properties-Datei '" + propertiesFileName + "': " + ioex.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ public abstract class XmlUtils {
|
|||
} catch (SAXException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (IOException e) {
|
||||
System.err.println(e);
|
||||
System.err.println("\n");
|
||||
System.err.println(e.getLocalizedMessage());
|
||||
Logger.error(String.valueOf(e));
|
||||
Logger.error("\n");
|
||||
Logger.error(e.getLocalizedMessage());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
doc.getDocumentElement().normalize();
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.texttechnologylab.project.gruppe_05_1.xml.mdb;
|
|||
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.mdb.BiografischeAngaben;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
|
@ -62,7 +63,7 @@ public class BiografischeAngaben_File_Impl extends BiografischeAngaben implement
|
|||
break;
|
||||
|
||||
default:
|
||||
System.err.println("Node name does not match anything known in BiografischeAngaben: " + current.getNodeName());
|
||||
Logger.error("Node name does not match anything known in BiografischeAngaben: " + current.getNodeName());
|
||||
}
|
||||
|
||||
current = current.getNextSibling();
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.texttechnologylab.project.gruppe_05_1.xml.mdb;
|
|||
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.mdb.Institution;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
|
@ -48,7 +49,7 @@ public class Institution_File_Impl extends Institution implements XmlOperations
|
|||
break;
|
||||
|
||||
default:
|
||||
System.err.println("Node name does not match anything known in Institution: " + current.getNodeName());
|
||||
Logger.error("Node name does not match anything known in Institution: " + current.getNodeName());
|
||||
}
|
||||
current = current.getNextSibling();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.texttechnologylab.project.gruppe_05_1.xml.mdb;
|
|||
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.mdb.MdbName;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class MdbName_File_Impl extends MdbName implements XmlOperations {
|
|||
break;
|
||||
|
||||
default:
|
||||
System.err.println("Node name does not match anything known in Name: " + current.getNodeName());
|
||||
Logger.error("Node name does not match anything known in Name: " + current.getNodeName());
|
||||
}
|
||||
|
||||
current = current.getNextSibling();
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.texttechnologylab.project.gruppe_05_1.xml.mdb;
|
|||
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.mdb.*;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.GeneralUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.XmlUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.XmlOperations;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -70,7 +71,7 @@ public class Wahlperiode_File_Impl extends Wahlperiode implements XmlOperations
|
|||
break;
|
||||
|
||||
default:
|
||||
System.err.println("Node name does not match anything known in Wahlperiode: " + current.getNodeName());
|
||||
Logger.error("Node name does not match anything known in Wahlperiode: " + current.getNodeName());
|
||||
}
|
||||
|
||||
current = current.getNextSibling();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.texttechnologylab.project.gruppe_05_1.xml.speeches;
|
||||
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.Logger;
|
||||
import org.texttechnologylab.project.gruppe_05_1.util.PPRUtils;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Impls.*;
|
||||
import org.texttechnologylab.project.gruppe_05_1.xml.speeches.Interfaces.AgendaItem;
|
||||
|
@ -44,7 +45,7 @@ public class SpeechParser {
|
|||
this.speeches = new ArrayList<>();
|
||||
this.agendaItems = new ArrayList<>();
|
||||
Set<Document> xmlDocuments = PPRUtils.processXML();
|
||||
System.out.println("All sessions parsed");
|
||||
Logger.info("All sessions parsed");
|
||||
for (org.w3c.dom.Document xmlDoc : xmlDocuments) {
|
||||
try {
|
||||
File tempFile = convertDocumentToFile(xmlDoc);
|
||||
|
@ -52,8 +53,8 @@ public class SpeechParser {
|
|||
sessions.add(session);
|
||||
tempFile.delete(); // Lösche die temporäre Datei nach der Verarbeitung
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error parsing XML document.");
|
||||
System.err.println(e.getMessage());
|
||||
Logger.error("Error parsing XML document.");
|
||||
Logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
return sessions;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue