I am in a situation where I have a package that is calling logging.debug(xxx). I want to disable all logging statements by this package. Is there a way to do that via config?
For example, every query I run is printing out in the console of the dev server:
DEBUG:root:SELECT Entities.path, Entities.entity FROM “dev~xxxx!!Entities” AS Entities INNER JOIN “dev~xxxx!!EntitiesByProperty” AS ebp_0 ON Entities.path = ebp_0.path INNER JOIN “dev~xxxx!!EntitiesByProperty” AS ebp_1 ON Entities.path = ebp_1.path INNER JOIN “dev~xxxx!!EntitiesByProperty” AS ebp_2 ON Entities.path = ebp_2.path WHERE ebp_0.kind = :1 AND ebp_0.name = :2 AND ebp_0.value = :3 AND ebp_1.kind = :4 AND ebp_1.name = :5 AND ebp_1.value = :6 AND ebp_2.kind = :7 AND ebp_2.name = :8 AND ebp_2.value = :9 ORDER BY Entities.path ASC
So I know how to disable it by modifying the sdk source, basically comment out the logging statement in __StarSchemaQueryPlan
logging.debug(query)
Is there a way to disable the logging without touching SDK code? We currently do not define any loggingConfigurations, and are using the basicConfiguror.
Final solution thank you @lucemia:
class Filter(object):
def filter(self, record):
if record.funcName=='__StarSchemaQueryPlan' and record.module=='datastore_sqlite_stub':
return 0
else:
return 1
You can try to modify the log level.
Since the module used default logger.
The following code will disable all log which’s level smaller than critical.
test case
a_lib.py
a_test_case.py
results
EDIT 1
Another way to do so is using filter