From 3479adb9ac726675f547aa639525459ac522eede Mon Sep 17 00:00:00 2001 From: Jan Martin Keil Date: Thu, 3 Mar 2022 11:39:35 +0100 Subject: [PATCH] improve logging --- measure.sh | 1 - pom.xml | 2 +- .../fusion/experiment/rdf_datatype_usage/ScanThread.java | 8 +++----- .../cs/fusion/experiment/rdf_datatype_usage/Scanner.java | 6 ++---- src/main/resources/log4j.properties | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/measure.sh b/measure.sh index dfe4b41..c0f3ef3 100755 --- a/measure.sh +++ b/measure.sh @@ -24,6 +24,5 @@ pushd "$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )" > /dev/null mkdir -p $1 -printf "\n\nStart measuring at %s ...\n" "$(date)" >> "$1/scan.log" nohup java -jar target/Scanner.jar --scan $1 < /dev/null >> "$1/scan.log" 2>&1 & popd > /dev/null diff --git a/pom.xml b/pom.xml index c81ea60..ab63363 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ de.uni_jena.cs.fusion experiment.rdf-datatype-usage - 2.1.0 + 2.1.1 RDF Property and Datatype Usage Scanner Creates statistics about the usage of properties and datatypes in Web Data Commons datasets. diff --git a/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/ScanThread.java b/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/ScanThread.java index 6ee3b7a..0c26c80 100644 --- a/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/ScanThread.java +++ b/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/ScanThread.java @@ -106,12 +106,11 @@ public void run() { long start = System.currentTimeMillis(); - log.info("{} - Start processing file: {} ({})", new Timestamp(start), url, identifier); + log.info("Start processing file: {} ({})", url, identifier); fileMeasure.startMeasurements(); fileMeasure.writeToDatabase(); long end = System.currentTimeMillis(); - log.info("{} - Finished processing after {} ms file: {} ({})", new Timestamp(end), end - start, - url, identifier); + log.info("Finished processing after {} ms file: {} ({})", end - start, url, identifier); } else { break; } @@ -119,8 +118,7 @@ public void run() { TimeUnit.HOURS.sleep(1); } catch (Throwable t) { if (identifier != null) { - log.info(new Timestamp(System.currentTimeMillis()) + " - Error during work on file " - + identifier); + log.info("Error during work on file " + identifier); } log.error(t.getMessage()); diff --git a/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/Scanner.java b/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/Scanner.java index 73866e7..5383e73 100644 --- a/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/Scanner.java +++ b/src/main/java/de/uni_jena/cs/fusion/experiment/rdf_datatype_usage/Scanner.java @@ -37,7 +37,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.sql.Timestamp; import java.util.concurrent.CountDownLatch; import java.util.zip.GZIPOutputStream; @@ -153,7 +152,7 @@ public void run() { } if (scan) { - log.info("Running scan"); + log.info("Start measuring"); scan(pool); } @@ -269,7 +268,6 @@ public void scan(JdbcConnectionPool pool) throws InterruptedException { latch.await(); long end = System.currentTimeMillis(); - log.info(String.format("[%s] Scan with %d threads finished after %d ms.", - new Timestamp(System.currentTimeMillis()), +this.threads, end - start)); + log.info(String.format("Scan with %d threads finished after %d ms.", this.threads, end - start)); } } diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties index 83e2a7a..3128ce5 100644 --- a/src/main/resources/log4j.properties +++ b/src/main/resources/log4j.properties @@ -25,4 +25,4 @@ log4j.rootLogger=INFO, STDOUT log4j.logger.deng=INFO log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout -log4j.appender.STDOUT.layout.ConversionPattern=[%t] %-5p %c %x - %m%n \ No newline at end of file +log4j.appender.STDOUT.layout.ConversionPattern=[%9t] %d %-5p [%10c{1}] %m%n \ No newline at end of file