fix missing/wrong logging

1. Log the exception in PdbFileIterator with a logger instead
   of just printing it to stderr.
2. Increase log level for exceptions when inserting entries.
3. Log exception when creation of entry failed in TcpIngestor.
This commit is contained in:
2017-04-17 18:27:25 +02:00
parent c58e7baf69
commit a99f6a276e
3 changed files with 7 additions and 2 deletions

View File

@@ -124,6 +124,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
final Entry entry = new Entry(date, duration, tags);
return Optional.of(entry);
} catch (final Exception e) {
LOGGER.error("Failed to create entry.", e);
return Optional.empty();
}
}

View File

@@ -8,9 +8,13 @@ import java.util.Queue;
import java.util.function.Supplier;
import org.lucares.pdb.api.Entry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PdbFileIterator implements Iterator<Entry>, AutoCloseable {
private final static Logger LOGGER = LoggerFactory.getLogger(PdbFileIterator.class);
private static final class EntrySupplier implements Supplier<Entry>, AutoCloseable {
private final Queue<PdbReader> pdbFiles;
@@ -65,7 +69,7 @@ public class PdbFileIterator implements Iterator<Entry>, AutoCloseable {
try {
pdbFiles.poll().close();
} catch (final Exception e) {
e.printStackTrace();
LOGGER.warn("Closing pdb file failed.", e);
}
}
}

View File

@@ -103,7 +103,7 @@ public class PerformanceDb implements AutoCloseable {
} catch (final InvalidValueException | SyntaxException e) {
LOGGER.info("skipping entry: " + e.getMessage() + " : " + entry);
LOGGER.debug("", e);
LOGGER.info("", e);
}
}