Bug 34510 - connexion_import_daemon.pl should flush logs to make them more useful / timely
Summary: connexion_import_daemon.pl should flush logs to make them more useful / timely
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-09 18:07 UTC by Jason Boyer
Modified: 2023-08-09 18:07 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Flush Connexion Import Daemon Log (786 bytes, application/mbox)
2023-08-09 18:07 UTC, Jason Boyer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Boyer 2023-08-09 18:07:40 UTC
Created attachment 154338 [details]
Flush Connexion Import Daemon Log

The connexion_import_daemon.pl tool can output logs to the location specified in its config file, but because it uses buffered files (fine) and never flushes the buffer (not fine) the latest log entries are not available until additional records are submitted or the daemon is restarted and the log filehandle closed.

The attached patch flushes the log only at the end of the request so the logs are usefully up to date without spamming i/o flushes on every call to log().

To test, pre-patch:
1. Export or locate a single marc record in binary format
2. Setup the connexion_import_daemon.pl as in https://koha-community.org/manual/19.11/en/html/third_party_software.html#oclc-connexion-gateway and take note of the logging location
3. Using Connexion or netcat, send the record to the specified port ( nc koha-host 8000 < recrd.mrc )
4. Check the logfile configured in 2. It will likely end somewhere in the middle of the "Response: XYZ" output (probably somewhere in the middle of some marcxml)
5. Stop the daemon and verify that the remainder of the response is logged
6. Apply the patch
7. Restart the import daemon and resend the record from step 3
8. This time the full response should be logged as soon as the record is sent