TOMToolkit / tom_base

The base Django project for a Target and Observation Manager
https://tom-toolkit.readthedocs.io
GNU General Public License v3.0
26 stars 46 forks source link

Handling logging output from custom apps installed in a TOM #1083

Open rachel3834 opened 1 week ago

rachel3834 commented 1 week ago

My TOM includes custom applications used to analyze data on my Targets, in this case fitting a model to a Target lightcurve. The app outputs its own logs, normally storing them to disk when run stand alone. I would like for the TOM to store this logging output so that I can make it available through the UI.
The TOM already uses Python's logging module to capture log streams, which can be viewed in a Cloud deployed-TOM via stern.

jchate6 commented 6 days ago

What sort of output (quantity mostly) are you expecting and how would you like it displayed?

rachel3834 commented 6 days ago

I'm mostly thinking of text logging, typically a few hundred KB in size. I'd like to be able to click a button next to the display of the graphical output from the app to display the logging output on demand.

On Mon, Oct 21, 2024 at 9:37 AM Joey Chatelain @.***> wrote:

What sort of output (quantity mostly) are you expecting and how would you like it displayed?

— Reply to this email directly, view it on GitHub https://github.com/TOMToolkit/tom_base/issues/1083#issuecomment-2427174871, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPJA3CMFFHL64TC6H6G5TLZ4UUS3AVCNFSM6AAAAABQEZLRBSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRXGE3TIOBXGE . You are receiving this because you authored the thread.Message ID: @.***>

jchate6 commented 2 days ago

I think one strategy would be:

  1. Set up a django model to keep track of your analysis runs. This could have foreign keys to a target, or whatever fields you need, but importantly also includes a FileField for log output.
  2. Pipe any logs or output for the run into a file that is connected to the run model.
  3. have a run detail page that displays (or downloads) the log file.

This would be good for larger logs that are specific to a single use case. capturing general logs or logs that are only a few lines of text should probably be handled in a different way.