-
Notifications
You must be signed in to change notification settings - Fork 145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some response data is also worth logging - like job cancel which has not been super reliable.
TODO: Fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add logging to websocket and ensure any causing exceptions are logged (e.g. if there's raise ex2 from ex1
make sure both ex2 and ex1 are logged)?
One more comment. You mentioned that you wanted to reuse |
Are you suggesting changing the level of the |
Some comments based on the Travis output:
|
Yes, if the |
This was the case because I had the setting in my Travis CI to hide the value set for Also, I added this into
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just a few small suggestions.
qiskit/providers/ibmq/api/session.py
Outdated
from the request, within the url and request data. | ||
|
||
The following endpoint URLs are not logged in order to reduce noise: ``/users`` | ||
and ``/version``. Likewise, the request data is only logged for the following |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docstring is now outdated with additional endpoints not being logged. It might be easier to either just say "not all endpoints are logged" or define a "constant" for excluded endpoints and just say those in the constant are not logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I separated filtering out url logs by introducing another private method _is_worth_logging(...), in order to make the filtering more readable and maintainable (in case we add other endpoints in the future). Would it be better to have a "constant" defined or would the function be an okay addition instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally like a "constant" since it's obvious and easy to update, but it's not a big deal to just use the method.
Summary
Addresses #524
Details and comments
This PR sets up a logger for the package, which allows loggers within the modules to inherit the correct level when the
QISKIT_IBMQ_PROVIDER_LOG_LEVEL
environment variable is set. Also, it allows users to specify a filename to place logs into, via theQISKIT_IBMQ_PROVIDER_LOG_FILE
environment variable.It also adds more debugging messages, using
Session.request
as the centralized logging placement.An example of the log format is:
The first part:
websocket.get_job_status:DEBUG:2020-03-17 16:21:45,632:
is formatted automatically.
The second part:
Received message from websocket: {'hubInfo': '...', 'id': '5e70f8f18a2f2f0018e12452', 'endDate': '2020-03-17T16:21:43.196Z', 'backend': {'id': '5ae875670f020500393162ad', 'name': '...'}, 'kind': 'q-object-external-storage', 'status': 'COMPLETED', 'creationDate': '2020-03-17T16:21:05.284Z'}
is the specified message to include in the log.