Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"import irods" shouldn't interfere in logging by applications or other modules #660

Open
d-w-moore opened this issue Nov 23, 2024 · 2 comments

Comments

@d-w-moore
Copy link
Collaborator

d-w-moore commented Nov 23, 2024

This line is very invasive to logging that the application (or other imported modules / libraries) might want to do:

logging.basicConfig()

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:

import logging
import irods
logging.basicConfig(level = logging.DEBUG)
logging.debug("hello!")
@d-w-moore 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 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
@d-w-moore
Copy link
Collaborator Author

d-w-moore commented 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:

import logging
logging.basicConfig( )
import irods

@d-w-moore
Copy link
Collaborator Author

d-w-moore commented Nov 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant