Improve logging for functions during error
Improve logging for functions during error conditions via @thejibz
Within watchdog binary:
The exec of process:
- results in non-zero exit code
- finds output in stderr and nothing in stdout
- gets output in stderr and stdout
https://github.com/alexellis/faas/pull/10#issuecomment-274496611
Also review whether panic is the correct behaviour for failure of exec.
See also: https://github.com/alexellis/faas/commit/b7d2845d6e10c0bf422226373949b6e861e56ba3
Every fprocess has only two sure ways to communicate with its fwatchdog atm: stdout and stderr. Beside these there is also the exit status code. So in my view :
For fprocess:
- stdout : ONLY valid result data must be printed here (e.g a final json object). No warning, error, debug output.
- stderr: ALL messages related to the execution of the fprocess (trace, debug, warn, error..).
For fwatchdog:
- Always print fprocess's stderr on its stdout.
- Never print fprocess's stdout on its stdout (because you can already get it on the fprocess container easily).
- In case of fprocess success, send a http response with fprocess's stdout content and Http.Ok status (200).
- In case of fprocess failure, send a http response with fprocess's stderr content and Http.Error status (500).
- No panic in case of fprocess failure.
These are of course suggestions to be debated. Cheers.
Agreed on this point - I will create an issue to track documenting it.
For fprocess: stdout : ONLY valid result data must be printed here (e.g a final json object). No warning, error, debug output. stderr: ALL messages related to the execution of the fprocess (trace, debug, warn, error..).
Hi @thejibz please could you review the current behaviour and get back to me?
@aafrey @vegasbrianc @nicolaka do you guys have any thoughts here?
@thejibz I've updated the latest watchdog code so that it will return the full stdout/stderr output upon error. Will close issue for now - can re-open if we need more granularity.