You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
d-w-moore
changed the title
keep "import irods" from interfering in application and other libraries
"import irods" shouldn't interfere in logging by applicationss or other modules
Nov 23, 2024
d-w-moore
changed the title
"import irods" shouldn't interfere in logging by applicationss or other modules
"import irods" shouldn't interfere in logging by applications or other modules
Nov 23, 2024
Once the basicConfig call is banished from the module, we probably won't see logging output from this short Python script as we might like to:
#!/usr/bin/env python3
# Run this script with PYTHON_IRODSCLIENT_CONFIGURATION_PATH set and the
# following line in the config file:
# data_objects.auto_close: True
import logging
import irods
We might expect streams should receive the output:
WARNING:irods.client_configuration:Invalid configuration format at line 1: 'data_objects.auto_close: True'
but they will not, as basicConfig(...) hasn't been called yet.
If this is fine by the application writer, no harm done. If they desire logging at that point however, we'll need the following modification to the above code:
On a side note, not sure whether colons shouldn't maybe be permitted in the config files. I can think of no reason why not. THoughts? If folks are ok with an optional colon being permitted at the end of the dotted name, I'll make another issue.
This line is very invasive to logging that the application (or other imported modules / libraries) might want to do:
python-irodsclient/irods/__init__.py
Line 32 in 5ae9590
basicConfig
is meant to be called only once within an application, and it probably shouldn't be here.For one thing, it means you cannot do this and see logging output:
The text was updated successfully, but these errors were encountered: