You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Ben Tomasini <be...@gmail.com> on 2012/09/21 01:52:32 UTC

Modifying log level in python libraries

Hello,

I am using the zookeeper Python bindings and am trying to suppress the
INFO level log messages it is producing.  I am new to Python logging.
I tried reconfiguring it with the following to no avail:

logging.basicConfig(level=logging.ERROR)

Any tips?

Thanks,

Ben

Re: Modifying log level in python libraries

Posted by Ben Tomasini <be...@gmail.com>.
Thanks.

I thought I was using the Python C binding lib.  I will try using the
Kazoo lib instead.

FWIW, Here is the log output I am trying to suppress:

2012-09-20 18:54:44,410:36343(0x7fff7a3cb960):ZOO_INFO@log_env@712:
Client environment:zookeeper.version=zookeeper C client 3.4.3
2012-09-20 18:54:44,411:36343(0x7fff7a3cb960):ZOO_INFO@log_env@716:
Client environment:host.name=btomasini-mac1.local
2012-09-20 18:54:44,411:36343(0x7fff7a3cb960):ZOO_INFO@log_env@723:
Client environment:os.name=Darwin
2012-09-20 18:54:44,411:36343(0x7fff7a3cb960):ZOO_INFO@log_env@724:
Client environment:os.arch=11.4.0

Ben

On Thu, Sep 20, 2012 at 5:41 PM, Ben Bangert <be...@groovie.org> wrote:
> On Sep 20, 2012, at 4:52 PM, Ben Tomasini <be...@gmail.com> wrote:
>
>> I am using the zookeeper Python bindings and am trying to suppress the
>> INFO level log messages it is producing.  I am new to Python logging.
>> I tried reconfiguring it with the following to no avail:
>>
>> logging.basicConfig(level=logging.ERROR)
>
> Could you be a little more specific on what library you're using to talk to Zookeeper?
>
> What you've written there will work.... if the code uses the Python standard logging library, which the Python C binding and C lib does not. I'd suggest trying Kazoo which is a pure Python Zookeeper library that uses standard Python logging calls.
>
> Also, logging.ERROR is pretty catastrophic, so most libraries ideally will never show anything at that level unless something horrible happened. Try setting it to logging.INFO or logging.DEBUG for more verbose messages.
>
> Cheers,
> Ben
>

Re: Modifying log level in python libraries

Posted by Ben Bangert <be...@groovie.org>.
On Sep 20, 2012, at 4:52 PM, Ben Tomasini <be...@gmail.com> wrote:

> I am using the zookeeper Python bindings and am trying to suppress the
> INFO level log messages it is producing.  I am new to Python logging.
> I tried reconfiguring it with the following to no avail:
> 
> logging.basicConfig(level=logging.ERROR)

Could you be a little more specific on what library you're using to talk to Zookeeper?

What you've written there will work.... if the code uses the Python standard logging library, which the Python C binding and C lib does not. I'd suggest trying Kazoo which is a pure Python Zookeeper library that uses standard Python logging calls.

Also, logging.ERROR is pretty catastrophic, so most libraries ideally will never show anything at that level unless something horrible happened. Try setting it to logging.INFO or logging.DEBUG for more verbose messages.

Cheers,
Ben