openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

Log stderr forking mode #154

Closed alexellis closed 1 year ago

alexellis commented 1 year ago

Description

Log stderr forking mode

Motivation and Context

Stream stderr to logs for streaming fork mode

This mode is not expected to be used by any customers in production, however we received a message from a customer who had decided to use this mode.

They reported not being able to log to stderr, I was able to reproduce the problem and have added bindLoggingPipe to stderr as per the other modes in the of-watchdog.

We only recommend HTTP mode for production use.

How Has This Been Tested?

After testing with a simple Python program, the logging is now available.

Test application:

#!/bin/python3

import sys

sys.stderr.write("Test\n")
sys.stderr.flush()

print("OK\n")

Test command:

port=8083 fprocess="python3 test.py" go run .

Before:

No specific logs other than:

2023/05/31 10:02:22 GET / - 200 - ContentLength: 4B (0.0171s)

After:

2023/05/31 10:02:22 Started logging: stderr from function.
2023/05/31 10:02:22 stderr: Test
2023/05/31 10:02:22 GET / - 200 - ContentLength: 4B (0.0171s)

Types of changes

Checklist:

alexellis commented 1 year ago

@vkryzh Please take a look. Can you confirm that this unblocks your urgent issue?

As per my email, we only recommend python3-http or python3-http-debian for production, not the forking mode of classic watchdog or of-watchdog.

Is there a special reason that you adopted it instead?

Alex

alexellis commented 1 year ago

Thanks for taking a look @welteki

vkryzh commented 1 year ago

@vkryzh Please take a look. Can you confirm that this unblocks your urgent issue?

As per my email, we only recommend python3-http or python3-http-debian for production, not the forking mode of classic watchdog or of-watchdog.

Is there a special reason that you adopted it instead?

Alex

Yes, it is. Thank you. We will check HTTP mode for our apps, thanks for pointing this out. Will get back as soon we will sort it out.

alexellis commented 1 year ago

@vkryzh

Please see:

https://github.com/openfaas/of-watchdog/releases/tag/0.9.12

You can switch to it when the build is completed: https://github.com/openfaas/of-watchdog/actions/runs/5131471379