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

[wptserve] Include server scheme in logging output #13632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jugglinmike
Copy link
Contributor

Because multiple server processes are started in parallel, requests logs
for each are interleaved in the parent process. Previously, they shared
the same configuration, so it was not possible to differentiate entries
added by each server process.

Use "child" loggers with names derived from the server scheme so that
each logging entry describes the server from which it originated.


Example output (starting the server, requesting http://web-platform.test:8000, then requesting https://web-platform.test:8443):

[...]

INFO:web-platform-tests.https:Starting server on web-platform.test:8443
DEBUG:web-platform-tests.http:GET /
DEBUG:web-platform-tests.http:Found handler FileHandler
DEBUG:web-platform-tests.http:200 GET / (None) 0
DEBUG:web-platform-tests.https:GET /
DEBUG:web-platform-tests.https:Found handler FileHandler
DEBUG:web-platform-tests.https:200 GET / (None) 0

In master today, the use of a single logger is clearly intentional. I don't understand the motivation, so I can't tell if introducing so-called "child" loggers is somehow undesirable.

The structure of the code suggests that some consumers might be supplying custom implementations of the RequestRewriter and Router classes. My preference is to avoid optional parameters when possible, but I've used them here in the interest of maintaining compatibility with those users.

Because multiple server processes are started in parallel, requests logs
for each are interleaved in the parent process. Previously, they shared
the same configuration, so it was not possible to differentiate entries
added by each server process.

Use "child" loggers with names derived from the server scheme so that
each logging entry describes the server from which it originated.
@jugglinmike
Copy link
Contributor Author

It looks like wptrunner is overriding the server's logger, and that the injected object is not API compatible with the logging object of the standard library.

This caught me off guard, and the patch clearly cannot be merged in this state. However, I am still interested in differentiating output from the various sub-processes, so I'll keep the pull request open and label it with a warning.

@jgraham @gsnedders do either of you have ideas about how we could implement something like this?

@gsnedders
Copy link
Member

@jgraham ping?

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

Successfully merging this pull request may close these issues.

3 participants