fix test issue

This commit is contained in:
AdoHe
2016-10-31 10:08:37 -04:00
parent 1e33cddf10
commit ff0a099eec
2 changed files with 7 additions and 9 deletions

View File

@@ -168,15 +168,10 @@ func (k *kernelLogWatcher) watchLoop() {
// getLogReader gets a kernel log reader.
func getLogReader(path string) (io.Reader, error) {
reader, err := tryJournal()
if err == nil {
return reader, nil
if len(path) != 0 {
return tryLogFile(path)
}
reader, err = tryLogFile(path)
if err == nil {
return reader, nil
}
return nil, err
return tryJournal()
}
func tryJournal() (io.Reader, error) {
@@ -205,6 +200,7 @@ func tryLogFile(path string) (io.Reader, error) {
return nil, err
}
glog.Infof("Kernel log watcher use log file: %s", path)
time.Sleep(1000 * time.Millisecond)
return tail, nil
}