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:
@@ -124,6 +124,7 @@ public class TcpIngestor implements Ingestor, AutoCloseable, DisposableBean {
|
|||||||
final Entry entry = new Entry(date, duration, tags);
|
final Entry entry = new Entry(date, duration, tags);
|
||||||
return Optional.of(entry);
|
return Optional.of(entry);
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
|
LOGGER.error("Failed to create entry.", e);
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,13 @@ import java.util.Queue;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.lucares.pdb.api.Entry;
|
import org.lucares.pdb.api.Entry;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class PdbFileIterator implements Iterator<Entry>, AutoCloseable {
|
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 static final class EntrySupplier implements Supplier<Entry>, AutoCloseable {
|
||||||
|
|
||||||
private final Queue<PdbReader> pdbFiles;
|
private final Queue<PdbReader> pdbFiles;
|
||||||
@@ -65,7 +69,7 @@ public class PdbFileIterator implements Iterator<Entry>, AutoCloseable {
|
|||||||
try {
|
try {
|
||||||
pdbFiles.poll().close();
|
pdbFiles.poll().close();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
LOGGER.warn("Closing pdb file failed.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public class PerformanceDb implements AutoCloseable {
|
|||||||
} catch (final InvalidValueException | SyntaxException e) {
|
} catch (final InvalidValueException | SyntaxException e) {
|
||||||
|
|
||||||
LOGGER.info("skipping entry: " + e.getMessage() + " : " + entry);
|
LOGGER.info("skipping entry: " + e.getMessage() + " : " + entry);
|
||||||
LOGGER.debug("", e);
|
LOGGER.info("", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user