jborean93 / smbprotocol

Python SMBv2 and v3 Client
MIT License
318 stars 73 forks source link

How can i disable logging in smbclient? #167

Closed resolutiontime closed 2 years ago

jborean93 commented 2 years ago

Logging isn’t enabled by default, you have to opt into it. Can you share more details.

resolutiontime commented 2 years ago

Thanks for the quick response. Of course i can share more details with you. Iam using smbclient on airflow server in DAG`s like this:


import smbclient smbclient.register_session(HOST, username=USERNAME, password=PASSWORD) with smbclient.open_file(PATH, mode="rb") as file: new_file = pd.read_excel(file)


And i get in DAG`s logfile a lot of rows of somthing from smbclient. It's about millions of lines that makes my logfile super large and not usable. Logfile how can i fix that? I think problem not in airflow server, problem is in configurations of smbclient. Thank you in advance!

adiroiban commented 2 years ago

Is this is basic stdlib logging question and not related to smbprotocol ?

Would something like this do the job ?

import logging
# Set level to your needs. The example disable the logs.
logging.getLogger('smbclient').setLevel(600)
logging.getLogger('smbprotocol').setLevel(600)
resolutiontime commented 2 years ago

It`s great! Sorry for this amateur question and thank you for operative. You helped me a lot!

jborean93 commented 2 years ago

Thanks @adiroiban for the info. This library uses the standard python library logging library. By default the logs aren’t enabled so sounds like the runner that’s being used is enabling them. Explicitly disabling them works as commented.