Exception AttributeError module 'couchbase' has no attribute 'enable_logging'

trying to get the couchbase logs working at debug level per Logging β€” Couchbase Python Client Library 2.1.1 documentation

but displite loading the couchbase python version 4.0.0 and importing it into my main when I call

couchbase.enable_logging()

I get this exception:

Exception has occurred: AttributeError
module 'couchbase' has no attribute 'enable_logging'
  File "C:\Users\larry.bilodeau\source\repos\university_incentives\Incentives_kafka_consumer\microservice\main.py", line 51, in <module>
    couchbase.enable_logging()

I have a β€œimport couchbase” at the top of my main.py; is ther some other form or library I specifically have to load?

I also have my environment variable LCB_LOGLEVEL=5 but am not seeing any couchbase log entries.

The documentation that you are referring to is for SDK version 2.1. This version is not supported anymore.

The updated documentation should be available here.

In Python SDK 4.0, there has been a significant change in logging implementation. Unfortunately, the docs have not been updated yet to reflect the changes. It will come in the coming days. The instructions are still for Python SDK 3.x.

For the Python SDK 4, the way to enable debug log level is using the environment variable, PYCBC_LOG_LEVEL.

For example,
$ PYCBC_LOG_LEVEL=debug python main.py

1 Like