Closed lstolcman closed 4 years ago
What if someone doesn't have the logging subsystem configured correctly? waitress does not assume that Python logging has been configured.
Does the default root logger output info logs?
What problem are you trying to solve for by capturing the output?
What if someone doesn't have the logging subsystem configured correctly? waitress does not assume that Python logging has been configured.
Does the default root logger output info logs?
Yes: https://docs.python.org/3/library/logging.html#logging.basicConfig https://docs.python.org/3/library/logging.handlers.html#logging.StreamHandler
What problem are you trying to solve for by capturing the output?
"I would like to catch "Serving on...." message using python logging module and process it later in my appllication."
Merge and or rebase master into this and make sure all the tests pass please.
@lstolcman nudge, did you see bert's request above?
@mmerickel @bertjwregeer done
Not sure if this is the best place to comment given the PR has already been merged, but didn't know if it was worth opening an issue for this:
Looks like this was not applied for the MultiSocketServer
, but only for BaseWSGIServer
. Creating an instance of a MultiSocketServer
will still use print
instead of self.log_info
.
@sr-gi would you please create a new issue, reference this one, and submit a PR with the proposed fix? I am pretty sure it will be accepted.
@sr-gi
Looks like this was not applied for the
MultiSocketServer
, but only forBaseWSGIServer
. Creating an instance of aMultiSocketServer
will still useself.log_info
.
Yeah, I only covered my use-case.
I saw the print for MultiSocketServer
, but did not fixed that to use logging, because I do not use that class. IMO if you'll replace the print with log_info, it should simply work
The problem:
I would like to catch "Serving on...." message using python logging module and process it later in my appllication. https://github.com/Pylons/waitress/blob/e2adf082e6942ee785bbc447beaa2c4d9764893f/src/waitress/__init__.py#L15 Currently, it outputs to stdout and could not be handled by logging system.
Solution: replace
print
withlog_info
(a wrapper for logging module)Merging it before releasing 2.0 would help me a lot
Connected with https://github.com/Pylons/waitress/issues/133