Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insufficient logging with WSGIServer configuration runtime #1227

Open
MrPippin66 opened this issue Dec 3, 2024 · 0 comments · May be fixed by #1229
Open

Insufficient logging with WSGIServer configuration runtime #1227

MrPippin66 opened this issue Dec 3, 2024 · 0 comments · May be fixed by #1229

Comments

@MrPippin66
Copy link

There are errors that may occur within the WSGIServer runtime that will not be logging to the logger instances defined with NCPA. Though generally not a huge problem for Linux, since these errors will in turn still get logged to STDERR (which nominally will get logged to systemd), which is a large problem for Windows agents, since the application isn't defined to open a console (for good reasons).

The primary issue APPEARS to be that the WSGIServer invocation isn't defining a error_log argument, such that ERROR messages will get passed to NCPA's logger mechanism.

The current invocation is defined as below (for listener):

WSGIServer(listener=(address, port), application=listener.server.listener, handler_class=WebSocketHandler, log=listener_logger, spawn=Pool(max_connections), **ssl_context)

What should be included is the argument 'error_log=listener_logger' as well.

Per the WSGIserver documentation:

log – If given, an object with a write method to which request (access) logs will be written. If not given, defaults to sys.stderr. You may pass None to disable request logging. You may use a wrapper, around e.g., logging, to support objects that don’t implement a write method. (If you pass a Logger instance, or in general something that provides a log method but not a write method, such a wrapper will automatically be created and it will be logged to at the INFO level.)

error_log – If given, a file-like object with write, writelines and flush methods to which error logs will be written. If not given, defaults to sys.stderr. You may pass None to disable error logging (not recommended). You may use a wrapper, around e.g., logging, to support objects that don’t implement the proper methods. This parameter will become the value for wsgi.errors in the WSGI environment (if not already set). (As with log, wrappers for Logger instances and the like will be created automatically and logged to at the ERROR level.)

My expectation is to get these internal errors messages, this option needs to be added. This is critical to debug items like SSL errors in the Windows agent.

Like changes should be done in other WSGIserver invocations elsewhere in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants