Parcourir la source

Merge pull request #33583 from naag/33569-logging-plugin-file-inconsistency

Pass the same log filename to logging plugins on start/stop requests
Sebastiaan van Stijn il y a 8 ans
Parent
commit
d053bdef15
2 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 3 1
      daemon/logger/adapter.go
  2. 1 0
      daemon/logger/plugin.go

+ 3 - 1
daemon/logger/adapter.go

@@ -3,6 +3,7 @@ package logger
 import (
 import (
 	"io"
 	"io"
 	"os"
 	"os"
+	"strings"
 	"sync"
 	"sync"
 	"time"
 	"time"
 
 
@@ -18,6 +19,7 @@ type pluginAdapter struct {
 	driverName   string
 	driverName   string
 	id           string
 	id           string
 	plugin       logPlugin
 	plugin       logPlugin
+	basePath     string
 	fifoPath     string
 	fifoPath     string
 	capabilities Capability
 	capabilities Capability
 	logInfo      Info
 	logInfo      Info
@@ -56,7 +58,7 @@ func (a *pluginAdapter) Close() error {
 	a.mu.Lock()
 	a.mu.Lock()
 	defer a.mu.Unlock()
 	defer a.mu.Unlock()
 
 
-	if err := a.plugin.StopLogging(a.fifoPath); err != nil {
+	if err := a.plugin.StopLogging(strings.TrimPrefix(a.fifoPath, a.basePath)); err != nil {
 		return err
 		return err
 	}
 	}
 
 

+ 1 - 0
daemon/logger/plugin.go

@@ -59,6 +59,7 @@ func makePluginCreator(name string, l *logPluginProxy, basePath string) Creator
 			driverName: name,
 			driverName: name,
 			id:         id,
 			id:         id,
 			plugin:     l,
 			plugin:     l,
+			basePath:   basePath,
 			fifoPath:   filepath.Join(root, id),
 			fifoPath:   filepath.Join(root, id),
 			logInfo:    logCtx,
 			logInfo:    logCtx,
 		}
 		}