Setting the log level for the cassandra driver

495 views
Skip to first unread message

Jason Aylward

unread,
Jul 13, 2017, 1:49:47 PM7/13/17
to DataStax Python Driver for Apache Cassandra User Mailing List
Hi.  I'm testing the Cassandra Driver python package to do some large inserts and I'm finding the amount the driver prints to the screen is even during normal behavior is pretty heavy.
Is there an internal variable to set the log level for the driver?
I don't see anything in the docs but I'm sure I'm not the only one that's had their terminal fill beyond capacity in a matter of minutes.

Thanks!

Jim Witschey

unread,
Jul 13, 2017, 2:15:48 PM7/13/17
to python-dr...@lists.datastax.com
Hi Jason,

Thanks for giving the Python driver a look.

> Is there an internal variable to set the log level for the driver?

The Python driver uses the standard library's logging module:

https://docs.python.org/3/library/logging.html

so you can use that module's tools to control logging behavior. For
example, you could :

>>> import logging
>>> logging.getLogger('cassandra').setLevel(logging.ERROR)

You can also control logging behavior for submodules, or log to files
instead of stdout. For more examples, I suggest starting here:

https://docs.python.org/3/howto/logging-cookbook.html

Jason Aylward

unread,
Jul 13, 2017, 2:21:12 PM7/13/17
to python-dr...@lists.datastax.com
I had a feeling it was something simple like that.
I've just never used the logging package to control an imported module.
Thanks a lot!


--
You received this message because you are subscribed to the Google Groups "DataStax Python Driver for Apache Cassandra User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-driver-user+unsub...@lists.datastax.com.


Reply all
Reply to author
Forward
0 new messages