You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/logging.rst
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,26 @@
10
10
Logging
11
11
~~~~~~~
12
12
13
-
The Python SDK uses Python's `logging <https://docs.python.org/3.6/library/logging.html>`_ module.
13
+
The Python SDK uses Python's `logging <https://docs.python.org/3.6/library/logging.html>`_ module.
14
14
15
15
Loggers for the Python SDK are ordered hierarchically, with the top level being ``oci`` (or ``oraclebmc`` if you are using the legacy OracleBMC package).
16
16
17
17
Logger names are of the form ``<hierarchy>.<id>`` where the ``<hierarchy>`` is similar to ``oci.base_client`` and ``<id>`` is the result of Python's built-in ``id()`` function. The implication of this is that different instances of the same class have different loggers.
18
18
19
+
The following code snippet is an example for configuring debug level logging for the oci package:
20
+
21
+
.. code-block:: python
22
+
import oci
23
+
import logging
24
+
25
+
# Enable debug logging
26
+
logging.getLogger('oci').setLevel(logging.DEBUG)
27
+
28
+
# Rest of code ...
29
+
19
30
Request Logging
20
31
================
21
-
Logging of the requests which the Python SDK sends to Oracle Cloud Infrastructure servicescan be enabled by setting the ``log_requests`` attribute to ``True`` in your configuration. This could be done in your configuration file, for example:
32
+
Request logging can be enabled for more detailed debugging information. Request logging outputs the requests that the Python SDK sends to Oracle Cloud Infrastructure services. This option can be enabled by setting the configuration attribute ``log_requests`` to ``True``. Alternatively, request logging can be enabled in your configuration file. For example:
22
33
23
34
.. code-block:: text
24
35
@@ -43,9 +54,11 @@ Or programmatically, for example:
43
54
"log_requests": True
44
55
}
45
56
57
+
Request logging enables debugging information in the Python http module. This debugging information can be quite verbose and the output will go to standard out. This http module does not use Python's logging module.
58
+
46
59
Once you have request logging in your config, you can create the appropriate logging handler(s) for your use case. For example to log to an output stream such as ``stderr`` you could do:
47
60
48
-
.. code-block:: python
61
+
.. code-block:: python
49
62
50
63
import oci
51
64
import logging
@@ -60,9 +73,10 @@ Once you have request logging in your config, you can create the appropriate log
60
73
# This call will emit log information to stderr
61
74
client.list_regions()
62
75
63
-
Note that request logging occurs at the following levels:
76
+
The oci module has logging at the following levels:
64
77
65
78
* ``INFO``: Request method and request URL
66
79
* ``DEBUG``: Request headers and body, and response headers
Request to change the compartment of given autoscaling configuration.
104
+
105
+
:param str opc_request_id: (optional)
106
+
107
+
:param str if_match: (optional)
108
+
For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
109
+
parameter to the value of the etag from a previous GET or POST response for that resource. The resource
110
+
will be updated or deleted only if the etag you provide matches the resource's current etag value.
111
+
112
+
:param str opc_retry_token: (optional)
113
+
A token that uniquely identifies a request so it can be retried in case of a timeout or
114
+
server error without risk of executing that same action again. Retry tokens expire after 24
115
+
hours, but can be invalidated before then due to conflicting operations (for example, if a resource
116
+
has been deleted and purged from the system, then a retry of the original creation request
117
+
may be rejected).
118
+
119
+
:param obj retry_strategy: (optional)
120
+
A retry strategy to apply to this specific operation/call. This will override any retry strategy set at the client-level.
121
+
122
+
This should be one of the strategies available in the :py:mod:`~oci.retry` module. A convenience :py:data:`~oci.retry.DEFAULT_RETRY_STRATEGY`
123
+
is also available. The specifics of the default retry strategy are described `here <https://oracle-cloud-infrastructure-python-sdk.readthedocs.io/en/latest/sdk_behaviors/retries.html>`__.
124
+
125
+
To have this operation explicitly not perform any retries, pass an instance of :py:class:`~oci.retry.NoneRetryStrategy`.
126
+
127
+
:return: A :class:`~oci.response.Response` object with data of type None
0 commit comments