faas icon indicating copy to clipboard operation
faas copied to clipboard

Improve logging for functions during error

Open alexellis opened this issue 9 years ago • 6 comments

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.

alexellis avatar Jan 23 '17 15:01 alexellis

See also: https://github.com/alexellis/faas/commit/b7d2845d6e10c0bf422226373949b6e861e56ba3

alexellis avatar Jan 23 '17 23:01 alexellis

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.

jb-rx avatar Jan 25 '17 09:01 jb-rx

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..).

alexellis avatar Jan 26 '17 23:01 alexellis

Hi @thejibz please could you review the current behaviour and get back to me?

alexellis avatar Mar 28 '17 18:03 alexellis

@aafrey @vegasbrianc @nicolaka do you guys have any thoughts here?

alexellis avatar Apr 12 '17 07:04 alexellis

@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.

alexellis avatar Jul 24 '17 10:07 alexellis