We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Following exception can occur if unknown level (eg. 'TRACE'):
future: <Task finished name='Task-2' coro=<Runner._update_status() done, defined at /home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/plugins/runner_nrunner.py:248> exception=ValueError("Unknown level: 'Level Level 5'")> Traceback (most recent call last): File "/home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/plugins/runner_nrunner.py", line 260, in _update_status message_handler.process_message(message, task, job) File "/home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/core/messages.py", line 71, in process_message handler.process_message(message, task, job) File "/home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/core/messages.py", line 89, in process_message handler.process_message(message, task, job) File "/home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/core/messages.py", line 56, in process_message self.handle(message, task, job) File "/home/gitlab-runner/venv/lib/python3.12/site-packages/avocado/core/messages.py", line 374, in handle logger.setLevel(level) File "/usr/lib/python3.12/logging/__init__.py", line 1514, in setLevel self.level = _checkLevel(level) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/logging/__init__.py", line 213, in _checkLevel raise ValueError("Unknown level: %r" % level) ValueError: Unknown level: 'Level Level 5'
Steps to reproduce When using avocado with module "requests" and exchanging file of more than 512 bytes, this log can happen in "charset_normalizer" api.py:l107 (https://github.com/jawah/charset_normalizer)
Workaround I found the following workaround but it should really be seen as only a workaround and I hope a real fix could be deployed
diff --git a/avocado/core/messages.py b/avocado/core/messages.py index ce77df8f..1ff40bdb 100644 --- a/avocado/core/messages.py +++ b/avocado/core/messages.py @@ -367,6 +367,7 @@ class LogMessageHandler(BaseRunningMessageHandler): # the Avocado job logging configuration log_name = message.get("log_name") if log_name is not None and log_name != "avocado.app": + logging.addLevelName(5, 'TRACE') logger = logging.getLogger(log_name) level = logging.getLevelName(message.get("log_levelname")) log_message = f"{task.identifier}: {message.get('log').decode(message.get('encoding'))}"
Current behavior What you are getting?
System information (please complete the following information):
The text was updated successfully, but these errors were encountered:
Hi @tpennors, thank you for reporting this. I was able to reproduce it with this reproducer:
import logging from avocado import Test class Test(Test): def test(self): TRACE = 5 logger = logging.getLogger("new_logger") logger.setLevel(TRACE) logger.log( TRACE, "Test", )
output:
Traceback (most recent call last): File "/home/janrichter/Avocado/avocado/avocado/plugins/runner_nrunner.py", line 260, in _update_status message_handler.process_message(message, task, job) File "/home/janrichter/Avocado/avocado/avocado/core/messages.py", line 71, in process_message handler.process_message(message, task, job) File "/home/janrichter/Avocado/avocado/avocado/core/messages.py", line 89, in process_message handler.process_message(message, task, job) File "/home/janrichter/Avocado/avocado/avocado/core/messages.py", line 56, in process_message self.handle(message, task, job) File "/home/janrichter/Avocado/avocado/avocado/core/messages.py", line 374, in handle logger.setLevel(level) File "/home/janrichter/.pyenv/versions/3.12.0/lib/python3.12/logging/__init__.py", line 1514, in setLevel self.level = _checkLevel(level) ^^^^^^^^^^^^^^^^^^ File "/home/janrichter/.pyenv/versions/3.12.0/lib/python3.12/logging/__init__.py", line 213, in _checkLevel raise ValueError("Unknown level: %r" % level) ValueError: Unknown level: 'Level Level 5'
Sorry, something went wrong.
No branches or pull requests
Describe the bug
Following exception can occur if unknown level (eg. 'TRACE'):
Steps to reproduce
When using avocado with module "requests" and exchanging file of more than 512 bytes, this log can happen in "charset_normalizer" api.py:l107 (https://github.com/jawah/charset_normalizer)
Workaround
I found the following workaround but it should really be seen as only a workaround and I hope a real fix could be deployed
Current behavior
What you are getting?
System information (please complete the following information):
The text was updated successfully, but these errors were encountered: