Skip to content

Log level not suppressed #2641

Closed as not planned
Closed as not planned
@nicholas-a-guerra

Description

@nicholas-a-guerra

It appears that on the latest versions the log levels aren't being applied to all logs in the source code. In my code I have these lines:

from pymodbus import pymodbus_apply_logging_config
pymodbus_apply_logging_config(level=logging.CRITICAL)

And yet I am still getting these every once in a while in my log output:

04-15-2025 14:29:03.177 EDT [ERROR] Fatal error: protocol.data_received() call failed.
protocol: <pymodbus.transaction.transaction.TransactionManager object at 0x7f67ffb920>
transport: <_SelectorSocketTransport fd=13 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 1027, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/usr/local/src/project/venv/lib/python3.12/site-packages/pymodbus/transport/transport.py", line 304, in data_received
    self.datagram_received(data, None)
  File "/usr/local/src/project/venv/lib/python3.12/site-packages/pymodbus/transport/transport.py", line 338, in datagram_received
    cut = self.callback_data(self.recv_buffer, addr=addr)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/src/project/venv/lib/python3.12/site-packages/pymodbus/transaction/transaction.py", line 192, in callback_data
    self.response_future.set_result(pdu)
asyncio.exceptions.InvalidStateError: invalid state

Since ERROR is lower than CRITICAL, I would expect these to be suppressed. I'm unsure how to suppress them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions