mirror of
https://github.com/Febbweiss/logstash-forwarder-java.git
synced 2026-03-04 22:25:39 +00:00
Repaired sincedb initialization
This commit is contained in:
@@ -48,7 +48,8 @@ public class FileWatcher {
|
||||
private boolean stdinConfigured = false;
|
||||
private String sincedbFile = null;
|
||||
|
||||
public FileWatcher() {
|
||||
public FileWatcher(String sincedbFileName) {
|
||||
sincedbFile = sincedbFileName;
|
||||
try {
|
||||
logger.debug("Loading saved states");
|
||||
savedStates = Registrar.readStateFromJson(sincedbFile);
|
||||
@@ -363,9 +364,4 @@ public class FileWatcher {
|
||||
public void setTail(boolean tail) {
|
||||
this.tail = tail;
|
||||
}
|
||||
|
||||
public void setSincedb(String sincedbFile) {
|
||||
this.sincedbFile = sincedbFile;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -72,10 +72,9 @@ public class Forwarder {
|
||||
try {
|
||||
parseOptions(args);
|
||||
setupLogging();
|
||||
watcher = new FileWatcher();
|
||||
watcher = new FileWatcher(sincedbFile);
|
||||
watcher.setMaxSignatureLength(signatureLength);
|
||||
watcher.setTail(tailSelected);
|
||||
watcher.setSincedb(sincedbFile);
|
||||
configManager = new ConfigurationManager(config);
|
||||
configManager.readConfiguration();
|
||||
for(FilesSection files : configManager.getConfig().getFiles()) {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class FileWatcherTest {
|
||||
|
||||
//@Test
|
||||
public void testFileWatch() throws InterruptedException, IOException {
|
||||
FileWatcher watcher = new FileWatcher();
|
||||
FileWatcher watcher = new FileWatcher(".logstash-forwarder-java");
|
||||
watcher.addFilesToWatch("./test.txt", new Event().addField("test", "test"), FileWatcher.ONE_DAY);
|
||||
for(int i = 0; i < 100; i++) {
|
||||
Thread.sleep(1000);
|
||||
@@ -60,7 +60,7 @@ public class FileWatcherTest {
|
||||
logger.warn("Not executing this test on windows");
|
||||
return;
|
||||
}
|
||||
FileWatcher watcher = new FileWatcher();
|
||||
FileWatcher watcher = new FileWatcher(".logstash-forwarder-java");
|
||||
watcher.addFilesToWatch("./testFileWatcher*.txt", new Event().addField("test", "test"), FileWatcher.ONE_DAY);
|
||||
watcher.initialize();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user