Commit 77d94297 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Simplify logging configuration.

Implements #33549.
parent 14504547
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
# Changes in version 1.1?.? - 2020-0?-??

 * Minor changes
   - Simplify logging configuration.


# Changes in version 1.14.1 - 2020-01-16

build @ fd856466

Original line number Diff line number Diff line
Subproject commit 264e498f54a20f7d299daaf2533d043f880e6a8b
Subproject commit fd856466bcb260f53ef69a24c102d0e49d171cc3
+2 −2
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import java.util.Map;
 */
public class Main {

  private static final Logger log = LoggerFactory.getLogger(Main.class);
  private static final Logger logger = LoggerFactory.getLogger(Main.class);

  public static final String CONF_FILE = "collector.properties";

@@ -116,7 +116,7 @@ public class Main {
          + ") and provide at least one data source and one data sink. "
          + "Refer to the manual for more information.");
    } catch (IOException e) {
      log.error("Cannot write default configuration.", e);
      logger.error("Cannot write default configuration.", e);
      throw new RuntimeException(e);
    }
  }
+4 −3
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ import org.slf4j.LoggerFactory;
 */
public final class ShutdownHook extends Thread {

  private static final Logger log = LoggerFactory.getLogger(ShutdownHook.class);
  private static final Logger logger
      = LoggerFactory.getLogger(ShutdownHook.class);

  private boolean stayAlive = true;

@@ -37,13 +38,13 @@ public final class ShutdownHook extends Thread {

  @Override
  public void run() {
    log.info("Shutdown in progress ... ");
    logger.info("Shutdown in progress ... ");
    Scheduler.getInstance().shutdownScheduler();
    synchronized (this) {
      this.stayAlive = false;
      this.notify();
    }
    log.info("Shutdown finished. Exiting.");
    logger.info("Shutdown finished. Exiting.");
  }
}
+6 −1
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@ import org.torproject.descriptor.BandwidthFile;
import org.torproject.metrics.collector.conf.Annotation;

import org.apache.commons.codec.digest.DigestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.file.Paths;
import java.time.LocalDateTime;
@@ -16,6 +18,9 @@ import java.time.format.DateTimeFormatter;
public class BandwidthFilePersistence
    extends DescriptorPersistence<BandwidthFile> {

  private static final Logger logger
      = LoggerFactory.getLogger(BandwidthFilePersistence.class);

  private static final String BANDWIDTH = "bandwidth";
  private static final String BANDWIDTHS = "bandwidths";

@@ -57,7 +62,7 @@ public class BandwidthFilePersistence
      System.arraycopy(bytes, start, forDigest, 0, forDigest.length);
      digest = DigestUtils.sha256Hex(forDigest).toUpperCase();
    } else {
      log.error("No digest calculation possible.  Returning empty string.");
      logger.error("No digest calculation possible.  Returning empty string.");
    }
    return digest;
  }
Loading