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

set default logger for import scripts to file handler #282

Closed
babslgam opened this issue Jan 13, 2025 · 3 comments · Fixed by #296
Closed

set default logger for import scripts to file handler #282

babslgam opened this issue Jan 13, 2025 · 3 comments · Fixed by #296
Assignees

Comments

@babslgam
Copy link
Contributor

https://github.com/acdh-oeaw/apis-instance-frischmuth/blob/deploy/apis_ontology/settings.py#L117

default logger for import results should be file based. at the moment it defaults to console. but we want to hand the log files over to the lit team.
maybe its also necessary to add a cron job to remove old log files.

@babslgam
Copy link
Contributor Author

@sennierer please have a look at this. i will have to run new imports soon.

sennierer added a commit that referenced this issue Feb 13, 2025
@sennierer sennierer linked a pull request Feb 13, 2025 that will close this issue
@sennierer
Copy link
Collaborator

Sorry for the late reply. So this should have worked already, but needed a env variable to work. I hard coded logging from scripts in the script folder to the imports file now. Everything is always logged to the same file. Given that we run the imports manually I think this should be fine (rest of the logs still goes to stout).
But your zotero import script doesnt log anything at current state.
I guess at least here https://github.com/acdh-oeaw/apis-instance-frischmuth/blob/deploy/apis_ontology/scripts/import_zotero_collections.py#L55-L61
you would need to use the logger imported here https://github.com/acdh-oeaw/apis-instance-frischmuth/blob/deploy/apis_ontology/scripts/import_zotero_collections.py#L34 to print the correct and the failed imports.
Please note that I dont have the needed access keys to zotero, but I added a log entry to the management command starting the script and it worked.

@babslgam
Copy link
Contributor Author

for clarification:
the logger is already used in multiple lines in the import script:

for the zotero import e.g.:
https://github.com/acdh-oeaw/apis-instance-frischmuth/blob/deploy/apis_ontology/scripts/import_zotero_collections.py#L724

for the excel import e.g.:
https://github.com/acdh-oeaw/apis-instance-frischmuth/blob/deploy/apis_ontology/scripts/import_nonbibl_entities_from_excel.py#L156

unfortunately we still have to deal with excel imports in the future. maybe we want to consider separating the logs.

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

Successfully merging a pull request may close this issue.

2 participants