This commit is part of a series to retire the Packaging Deb
project. Step 2 is to remove all content from the project
repos, replacing it with a README notification where to find
ongoing work, and how to recover the repo if needed at some
future point (as in
https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project).
Change-Id: I9fec1fbe4198abd8eba934b3162cee1aea128a1d
* Update setup.cfg/README.rst with right document links
* Update HACKING.rst with latest link for hacking
Change-Id: I0ff110b56fc86aa144d2ad67af5f0f09e75ad561
Further reduce the clutter from error_summary by only including it when
the log message will be emitted for the warning level or above.
Change-Id: Ia46a7e569b875cd75fec652dfe8a4d73661dfda8
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
In the Cinder project restarting the volume service is problematic
because it's not only in the control path but also in the data path of
some operations, so restarting it to change log levels is really
disruptive because it takes a long time to be done properly and it does
not support Active-Active configurations yet.
For this reason there's a specific API to change the log levels
dynamically based on a given prefix [1], but this feature is accessing
directly the `_loggers` dictionary which is not ideal.
This patch adds a simple method called `get_loggers` that will return a
copy of the internal `_loggers` dictionary so that the Cinder feature
can be changed to use this instead.
[1] https://review.openstack.org/445885
Change-Id: Ife33a5dd044a4565ad6a4d559ef9f0c108f260a3
We catch exceptions and log debug messages a lot, which results in extra
occurrences of the exception when we don't need them.
Change-Id: I4dd3bf65fb456afc07a8fa7d0c9869bcc266b800
Related-Bug: #1696213
Related-Bug: #1696855
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
In some projects, we conditionally import modules that may be not
installed, for example in Neutron where we import from ibm_db_alembic
but ignore ImportError in alembic env.py.
It turned out that ImportError is not cleared by except: pass in py2
(but is correctly cleared in py3), as can be seen in the snippet below
(kudos to @dhellmann for providing it):
apu:~$ cat testme.py
import sys
print('before:', sys.exc_info()[0])
try:
import nonesuch
except ImportError:
pass
print('after:', sys.exc_info()[0])
apu:~$ python2 ./testme.py
('before:', None)
('after:', <type 'exceptions.ImportError'>)
apu:~$ python3 ./testme.py
before: None
after: None
The patch makes the formatter skip ImportErrors. We could in theory
limit it to py2 only but to simplify matters and to stick to identical
behavior across python runtimes, we will just unconditionally skip it
for all library consumers.
This is a follow up to Ifecb831c0adf4086a9d39feb3eb7e3865db780e6 ("skip
built-in exceptions when adding error_summary") that already skipped
some builtin exceptions.
Change-Id: Ia8f7e2501a49345b8d828ec3ee4a7cc870c8a0a8
log_method_call decorator miss first argument of staticmethod and function.
the cause of bug is wrong start position of argument array for staticmethod.
This patch adds a bug fix and test code.
Change-Id: Id83378ba5954a855f18a4fdcfd22d2c7887991b2
Closes-Bug: #1672283
Update the comment to explain what the test does, rather than what the
old test that was copied to create the new test did.
Change-Id: I1a23d1134a3b0269bd2a61b8768a64fe6039fe85
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Oslo i18n removed babel from requirements but it has a runtime
dependency on it, so it fails to install.
g-r change: Ib77b3271a4e9861e391623ba5f03e5303512096a
Related-Bug: #1692773
Change-Id: I99afc304b2f0955a190ea5f298cdd1018bdf4ae4
The class WritableLogger was deprecated since liberty, and it's not
used by other projects, just remove it.
Depends-On: If8adae9807387fd32bad9923f5c7dab769572035
Depends-On: I1709f8a3f3ec50567b7f6217c3c1a2a61eecae62
Change-Id: I1ebed0855c5f9f410d8f6fbd786ce5b3409d8eb6
Incorporate some of the information from the upstream docs here and add
information about a few of our custom message parameters.
Change-Id: Ib6f934e7f5d6e43afa8021241f92000c644c5e6d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
We have a lot of cases where we catch a built-in exception then
log. Those exceptions don't add useful information, so do not include
them automatically in the log output.
Change-Id: Ifecb831c0adf4086a9d39feb3eb7e3865db780e6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Allow operators to override the location of the error summary within the
format string, if they choose.
Change-Id: I85fe5abaa0781d033638e3b6f120184726d205ac
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Normally when logging while there is an active exception, the exception
is formatted as a traceback and the log message string ends up on a
separate line. This change adds the 1-line summary of the exception,
including the exception class name and the text of the exception, to the
end of the log line. The traceback is retained, so that the full details
are still logged.
Adding the exception info in the formatter means that the default
excepthook function no longer needs to do that (otherwise we end up with
duplicate information on the lines logged by the excepthook). Fix the
duplication by replacing the extra traceback formatting with a static
message that there is an unhandled error.
Depends-On: Icb2e1c6d9fe40229119467e9261055d9464d331d
Change-Id: Ib29883a1b7aa665b5d3c728dd7bd53d449987191
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
In ContextFormatter.format(), for python2 it checks each arg to
determine whether unicode should be used for the format message.
The problem is the code assumes the args are a list, when they can
also be a dict, for example:
LOG.info('%(thing)s', {'thing': '...'})
and in that case, the dict keys were implicitly being used for the
checks. The checks will always pass on string dict keys, so the
format message gets converted to unicode even though the corresponding
args will ultimately fail decoding to unicode. Then, the logging fails
with:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc6 in
position 0: ordinal not in range(128)
when the unicode format message causes an implicit conversion attempt
of the args to unicode [1].
This adds a check for the args type and uses the dict values for the
unicode checks so that dict args with values that fail decoding will
have: should_use_unicode = False.
Closes-Bug: #1580728
[1] https://github.com/python/cpython/blob/2e576f5/Lib/logging/__init__.py#L338
Change-Id: I8c479e507efcf8acd3e3faa4a702fa6e1f18772f
The namespace name (oslo.messaging) is set to INFO, but we don't do it
with the oslo_messaging package name. It logs with both prefix, so we
should set INFO on both.
Change-Id: Ia8e53b0b40dd546abecc73abe855939200167ee8
Upstream python-systemd has a journald logging handler that also adds
some exception information, as well as thread information.
https://github.com/systemd/python-systemd/blob/master/systemd/journal.py#L581-L589
While OpenStack doesn't use a lot of threads, we might as well support it
since it's no cost. Also, add PROCESS_NAME just to be compatible with
other programs that might use python journald logging. Not entirely sure
if record.processName and the results of our self.binary_name will be
different.
The exception info is the fun stuff though.
Change-Id: Ibf0d7dae7587639737e0327f0338f30cdfc6aba1