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

Request and response logging #1045

Open
IvarVirusiim opened this issue Aug 23, 2023 · 0 comments
Open

Request and response logging #1045

IvarVirusiim opened this issue Aug 23, 2023 · 0 comments

Comments

@IvarVirusiim
Copy link

IvarVirusiim commented Aug 23, 2023

Is your feature request related to a problem? Please describe.

It's sometimes unclear why some requests fail. When there would be a possibility to log all requests and response, that move between SDK and vCenter, would make debugging easier. Since the amount of data can be big and many requests aren't relevant, a way to filter (include or exclude requests/responses by name) would be appreciated.

Describe the solution you'd like

Standard python logging would be preferred. The solution should have a way to configure, which requests and responses are being logged (include or exclude by name)

Describe alternatives you've considered

If there would be a way to add custom hooks for pyVmomi.SoapAdapter.SoapStubAdapter.InvokeMethod, then user could decide how the logging is done. Those would be then passed on through the connection (ServiceInstance)

Example:

    def InvokeMethod(self, mo, info, args, outerStub=None, request_logger=None, response_logger=None):

...

        try:
            request_logger(mo)
        except:
            ...
        req = self.SerializeRequest(mo, info, args)

...

            conn.request('POST', self.path, req, headers)
            resp = conn.getresponse()
            try:
                response_logger(resp)
            except:
                ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant