Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkeil committed Mar 3, 2022
1 parent ce97818 commit 3479adb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
1 change: 0 additions & 1 deletion measure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>de.uni_jena.cs.fusion</groupId>
<artifactId>experiment.rdf-datatype-usage</artifactId>
<version>2.1.0</version>
<version>2.1.1</version>

<name>RDF Property and Datatype Usage Scanner</name>
<description>Creates statistics about the usage of properties and datatypes in Web Data Commons datasets.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,19 @@ 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;
}
} catch (NoSuchElementException e) {
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());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -153,7 +152,7 @@ public void run() {
}

if (scan) {
log.info("Running scan");
log.info("Start measuring");
scan(pool);
}

Expand Down Expand Up @@ -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));
}
}
2 changes: 1 addition & 1 deletion src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
log4j.appender.STDOUT.layout.ConversionPattern=[%9t] %d %-5p [%10c{1}] %m%n

0 comments on commit 3479adb

Please sign in to comment.