Migrated logs to my implementation
This commit is contained in:
parent
0693e78851
commit
b821a6d318
8 changed files with 24 additions and 21 deletions
|
@ -697,12 +697,12 @@ public class MongoDBHandler {
|
|||
int modifiedCount = result.getModifiedCount();
|
||||
int matchedCount = result.getMatchedCount();
|
||||
int upsertCount = result.getUpserts().size();
|
||||
System.out.println("Bulk write operation completed: "
|
||||
Logger.info("Bulk write operation completed: "
|
||||
+ modifiedCount + " documents updated, "
|
||||
+ matchedCount + " documents matched, "
|
||||
+ upsertCount + " upserts.");
|
||||
} else {
|
||||
System.out.println("No operations to write.");
|
||||
Logger.warn("No operations to write.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ public class MongoPprUtils {
|
|||
if (tmp == null) {
|
||||
tmp = GeneralUtils.parseDateTime(dateTimeString, "dd.MM.yyyy H:mm");
|
||||
if (tmp == null) {
|
||||
System.out.println(dateTimeString + " could not be parsed");
|
||||
Logger.error(dateTimeString + " could not be parsed");
|
||||
}
|
||||
}
|
||||
md.setDateTime(tmp);
|
||||
|
|
|
@ -194,8 +194,8 @@ public class NlpUtils {
|
|||
}
|
||||
|
||||
JCasUtil.select(tCas, Sentence.class).forEach(sentence -> {
|
||||
System.out.println(sentence.getBegin()+"-"+sentence.getEnd()+": "+sentence.getCoveredText());
|
||||
System.out.println(JCasUtil.selectCovered(org.hucompute.textimager.uima.type.Sentiment.class, sentence));
|
||||
Logger.info(sentence.getBegin()+"-"+sentence.getEnd()+": "+sentence.getCoveredText());
|
||||
Logger.info(JCasUtil.selectCovered(org.hucompute.textimager.uima.type.Sentiment.class, sentence).toString());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ public class XmiExtractor {
|
|||
}
|
||||
processedCount++;
|
||||
if (processedCount % 5000 == 0) {
|
||||
System.out.println("Processed speeches: " + processedCount);
|
||||
Logger.info("Processed speeches: " + processedCount);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import io.javalin.openapi.*;
|
|||
import org.texttechnologylab.project.gruppe_05_1.domain.html.Parlamentarier;
|
||||
import org.texttechnologylab.project.gruppe_05_1.domain.html.ParlamentarierDetails;
|
||||
import org.texttechnologylab.project.gruppe_05_1.database.MongoPprUtils;
|
||||
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.Interfaces.Speech;
|
||||
|
||||
|
@ -50,11 +51,11 @@ public class ParlamentarierController {
|
|||
})
|
||||
public static void getAllParlamentarier(Context ctx) {
|
||||
String filter = ctx.queryParam("filter");
|
||||
System.out.println("Filter: '" + filter + "'");
|
||||
Logger.info("Filter: '" + filter + "'");
|
||||
|
||||
List<Parlamentarier> parlamentarier = MongoPprUtils.getAllParlamentarier(filter);
|
||||
PPRUtils.sortParlamentarierByName(parlamentarier);
|
||||
System.out.println(parlamentarier.size() + " MdBs gefunden");
|
||||
Logger.info(parlamentarier.size() + " MdBs gefunden");
|
||||
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
attributes.put("parlamentarier", parlamentarier);
|
||||
|
@ -86,7 +87,7 @@ public class ParlamentarierController {
|
|||
})
|
||||
public static void getParlamentarierDetails(Context ctx) {
|
||||
String id = ctx.pathParam("id");
|
||||
System.out.println("getParlamentarierDetails, ID = " + id);
|
||||
Logger.info("getParlamentarierDetails, ID = " + id);
|
||||
|
||||
ParlamentarierDetails pd = MongoPprUtils.getParlamentarierDetailsByID(id);
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import java.util.stream.Collectors;
|
|||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
import static org.texttechnologylab.project.gruppe_05_1.Main.FORCE_UPLOAD_MEMBERS;
|
||||
|
||||
public abstract class PPRUtils {
|
||||
|
||||
public static final String PARTEILOS_KUERZEL = "Parteilos";
|
||||
|
@ -51,10 +53,10 @@ public abstract class PPRUtils {
|
|||
|
||||
// MdB lesen: MDBs werden nur dann gelesen und persistiert, wenn die Collection noch leer ist
|
||||
String mdbUrl = xmlProperties.getProperty("mdb_url");
|
||||
if (MongoPprUtils.getSpeakerCollection().countDocuments() == 0) {
|
||||
if (MongoPprUtils.getSpeakerCollection().countDocuments() == 0 || FORCE_UPLOAD_MEMBERS) {
|
||||
readAndPersistMdbs(mdbUrl, xmlFactory, mongoFactory);
|
||||
} else {
|
||||
System.out.println("MDBs (Speakers) werden nicht gelesen, da sie bereits in der Datenbank stehen");
|
||||
Logger.warn("Members already in the DB. Skipping...");
|
||||
}
|
||||
|
||||
// Reden und Kommentare einlesen und persistieren - TODO
|
||||
|
@ -336,7 +338,7 @@ public abstract class PPRUtils {
|
|||
Document htmlDoc = Jsoup.connect(queryUrl).get();
|
||||
Elements xmlLinks = htmlDoc.select("a.bt-link-dokument");
|
||||
if (xmlLinks.isEmpty()) {
|
||||
System.out.println("Keine weiteren Protokolle gefunden.");
|
||||
Logger.info("No further protocols found");
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -347,14 +349,14 @@ public abstract class PPRUtils {
|
|||
org.w3c.dom.Document xmlDoc = downloadAndParseXML(xmlUrl);
|
||||
String uniqueId = xmlDoc.getDocumentElement().getAttribute("sitzung-nr");
|
||||
if (processedProtocols.contains(uniqueId)) {
|
||||
System.out.println("Protokoll bereits verarbeitet: " + uniqueId);
|
||||
Logger.warn("Protocol already processed: " + uniqueId);
|
||||
continue;
|
||||
}
|
||||
processedProtocols.add(uniqueId);
|
||||
xmlProtocols.add(xmlDoc);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Fehler beim Verarbeiten der XML-Datei: " + xmlUrl);
|
||||
System.err.println("Fehler: " + e.getLocalizedMessage());
|
||||
Logger.error("Fehler beim Verarbeiten der XML-Datei: " + xmlUrl);
|
||||
Logger.error("Fehler: " + e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,8 +373,8 @@ public abstract class PPRUtils {
|
|||
hasMore = false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
System.err.println("Fehler beim Laden der Seite: " + queryUrl);
|
||||
System.err.println("Fehler: " + e.getLocalizedMessage());
|
||||
Logger.error("Fehler beim Laden der Seite: " + queryUrl);
|
||||
Logger.error("Fehler: " + e.getLocalizedMessage());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,12 +11,12 @@ public abstract class PropertiesUtils {
|
|||
Properties properties = new Properties();
|
||||
try (InputStream input = PropertiesUtils.class.getClassLoader().getResourceAsStream(propertiesFileName)) {
|
||||
if (null == input) {
|
||||
System.err.println("Properties-Datei '" + propertiesFileName + "' konnte nicht gelesen werden");
|
||||
Logger.warn("Failed to read properties file '" + propertiesFileName);
|
||||
}
|
||||
|
||||
properties.load(input);
|
||||
} catch (IOException ioex) {
|
||||
System.err.println("Exception beim Lesen der properties-Datei '" + propertiesFileName + "': " + ioex.getLocalizedMessage());
|
||||
Logger.warn("Exception occured while reading properties file '" + propertiesFileName + "': " + ioex.getLocalizedMessage());
|
||||
}
|
||||
|
||||
return properties;
|
||||
|
|
|
@ -108,7 +108,7 @@ public abstract class XmlUtils {
|
|||
NodeList nl = origin.getChildNodes();
|
||||
for (int i=0 ; i< nl.getLength() ; i++) {
|
||||
Node n = nl.item(i);
|
||||
System.out.println(nl.item(i));
|
||||
Logger.info(String.valueOf(nl.item(i)));
|
||||
}
|
||||
|
||||
List<Node> list = new ArrayList<>();
|
||||
|
@ -237,7 +237,7 @@ public abstract class XmlUtils {
|
|||
break;
|
||||
|
||||
default:
|
||||
System.out.println("Unknown type in getRawText(), depth " + depth
|
||||
Logger.warn("Unknown type in getRawText(), depth " + depth
|
||||
+"Type = " + node.getNodeType()
|
||||
+ " / Name = '" + node.getNodeName()
|
||||
+ "' / Value = '" + node.getNodeValue()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue