commit 532113b857245e65be012c0dbdf3b5b33e72d5fb Author: Karsten Loesing karsten.loesing@gmx.net Date: Wed Oct 8 08:08:25 2014 +0200
Make logs more useful.
Implements #13362. --- logback.xml | 8 ++++---- src/main/java/org/torproject/onionoo/cron/Main.java | 4 ++-- .../org/torproject/onionoo/updater/StatusUpdateRunner.java | 6 +++--- .../org/torproject/onionoo/writer/DocumentWriterRunner.java | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/logback.xml b/logback.xml index f6d16d0..fcf278c 100644 --- a/logback.xml +++ b/logback.xml @@ -2,12 +2,12 @@
<!-- don't forget the trailing slash! --> <property name="logfile-base" value="/srv/onionoo.torproject.org/onionoo/" /> - <property name="utc-date-pattern" value="%date{yyyy-MM-dd HH:mm:ss, UTC}" /> + <property name="utc-date-pattern" value="%date{ISO8601, UTC}" />
<appender name="FILEALL" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${logfile-base}onionoo-all.log</file> <encoder> - <pattern>${utc-date-pattern} %level [runtime: %r] %logger{20}:%line %msg%n</pattern> + <pattern>${utc-date-pattern} %level %logger{20}:%line %msg%n</pattern> </encoder> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- rollover daily --> @@ -24,7 +24,7 @@ <appender name="FILEERR" class="ch.qos.logback.core.FileAppender"> <file>${logfile-base}onionoo-err.log</file> <encoder> - <pattern>${utc-date-pattern} %level %logger{30}(%line): %msg%n</pattern> + <pattern>${utc-date-pattern} %level %logger{20}:%line %msg%n</pattern> </encoder>
<!-- ERROR or worse --> @@ -36,7 +36,7 @@ <appender name="FILESTATISTICS" class="ch.qos.logback.core.FileAppender"> <file>${logfile-base}onionoo-statistics.log</file> <encoder> - <pattern>${utc-date-pattern} [runtime: %r] %msg%n</pattern> + <pattern>${utc-date-pattern} %msg%n</pattern> </encoder>
<!-- only INFO level --> diff --git a/src/main/java/org/torproject/onionoo/cron/Main.java b/src/main/java/org/torproject/onionoo/cron/Main.java index d9cb1b1..986f22d 100644 --- a/src/main/java/org/torproject/onionoo/cron/Main.java +++ b/src/main/java/org/torproject/onionoo/cron/Main.java @@ -63,8 +63,8 @@ public class Main { log.info("Gathering statistics."); sur.logStatistics(); dwr.logStatistics(); - log.info("Descriptor source", dso.getStatsString()); - log.info("Document store", ds.getStatsString()); + log.info("Descriptor source\n" + dso.getStatsString()); + log.info("Document store\n" + ds.getStatsString());
log.info("Releasing lock."); if (lf.releaseLock()) { diff --git a/src/main/java/org/torproject/onionoo/updater/StatusUpdateRunner.java b/src/main/java/org/torproject/onionoo/updater/StatusUpdateRunner.java index 2080697..50604bf 100644 --- a/src/main/java/org/torproject/onionoo/updater/StatusUpdateRunner.java +++ b/src/main/java/org/torproject/onionoo/updater/StatusUpdateRunner.java @@ -45,12 +45,12 @@ public class StatusUpdateRunner { String statsString = su.getStatsString(); if (statsString != null) { LoggerFactory.getLogger("statistics").info( - su.getClass().getSimpleName(), statsString); + su.getClass().getSimpleName() + "\n" + statsString); } } - LoggerFactory.getLogger("statistics").info("GeoIP lookup service", + LoggerFactory.getLogger("statistics").info("GeoIP lookup service\n" + this.ls.getStatsString()); LoggerFactory.getLogger("statistics").info("Reverse domain name " - + "resolver", this.rdnr.getStatsString()); + + "resolver\n" + this.rdnr.getStatsString()); } } diff --git a/src/main/java/org/torproject/onionoo/writer/DocumentWriterRunner.java b/src/main/java/org/torproject/onionoo/writer/DocumentWriterRunner.java index dbca06e..07bdf3c 100644 --- a/src/main/java/org/torproject/onionoo/writer/DocumentWriterRunner.java +++ b/src/main/java/org/torproject/onionoo/writer/DocumentWriterRunner.java @@ -34,7 +34,7 @@ public class DocumentWriterRunner { for (DocumentWriter dw : this.documentWriters) { String statsString = dw.getStatsString(); if (statsString != null) { - log.info(dw.getClass().getSimpleName(), + log.info(dw.getClass().getSimpleName() + "\n" + statsString); } }
tor-commits@lists.torproject.org