diff --git a/executor/logging.go b/executor/logging.go index eb9575d1..b6d435a1 100644 --- a/executor/logging.go +++ b/executor/logging.go @@ -10,7 +10,6 @@ import ( ) // bindLoggingPipe spawns a goroutine for passing through logging of the given output pipe. -// func bindLoggingPipe(name string, pipe io.Reader, output io.Writer, logPrefix bool, maxBufferSize int) { log.Printf("Started logging: %s from function.", name) diff --git a/executor/serializing_fork_runner.go b/executor/serializing_fork_runner.go index ed96f29b..92c07d77 100644 --- a/executor/serializing_fork_runner.go +++ b/executor/serializing_fork_runner.go @@ -8,6 +8,7 @@ import ( "fmt" "io" "io/ioutil" + "os" units "github.com/docker/go-units" @@ -21,8 +22,9 @@ import ( // SerializingForkFunctionRunner forks a process for each invocation type SerializingForkFunctionRunner struct { - ExecTimeout time.Duration - LogPrefix bool + ExecTimeout time.Duration + LogPrefix bool + LogBufferSize int } // Run run a fork for each invocation @@ -99,11 +101,14 @@ func serializeFunction(req FunctionRequest, f *SerializingForkFunctionRunner) (* stdout, _ := cmd.StdoutPipe() stdin, _ := cmd.StdinPipe() + stderr, _ := cmd.StderrPipe() if err := cmd.Start(); err != nil { return nil, err } + bindLoggingPipe("stderr", stderr, os.Stderr, f.LogPrefix, f.LogBufferSize) + functionRes, errors := pipeToProcess(stdin, stdout, &data) if len(errors) > 0 { return nil, errors[0] diff --git a/main.go b/main.go index 0e8602e8..279db892 100644 --- a/main.go +++ b/main.go @@ -233,8 +233,9 @@ func createLockFile() (string, error) { func makeSerializingForkRequestHandler(watchdogConfig config.WatchdogConfig, logPrefix bool) func(http.ResponseWriter, *http.Request) { functionInvoker := executor.SerializingForkFunctionRunner{ - ExecTimeout: watchdogConfig.ExecTimeout, - LogPrefix: logPrefix, + ExecTimeout: watchdogConfig.ExecTimeout, + LogPrefix: logPrefix, + LogBufferSize: watchdogConfig.LogBufferSize, } return func(w http.ResponseWriter, r *http.Request) {