dchaley / deepcell-imaging

Tools & guidance to scale DeepCell imaging on Google Cloud Batch
8 stars 2 forks source link

Use JSON logging #278

Closed dchaley closed 3 months ago

dchaley commented 3 months ago

GCP logging understands the JSON logstash format, not whatever Python loggers output normally.

This adds a helper function to configure a logger with a new handler which formats the log to JSON.

This should improve our logs in the GCP log viewer, for example it should no longer incorrectly identify logs as errors.

Note: we observed strange behavior locally: on our first run, it wrote to the classic (stdout) formatter AS WELL as the json formatter. It never did that again, and we're not sure if we changed anything. Well, it doesn't do it anymore… but let's keep an eye out.

Paired with @WeihaoGe1009

Fixes #220