metaflow-service icon indicating copy to clipboard operation
metaflow-service copied to clipboard

Log messages sometimes do not appear

Open fumoboy007 opened this issue 1 year ago • 3 comments

The code uses Python’s print function to log messages. However, print is buffered by default, so messages may not appear immediately or at all.

fumoboy007 avatar Sep 09 '24 22:09 fumoboy007

@fumoboy007 which code?

savingoyal avatar Sep 09 '24 22:09 savingoyal

@savingoyal All code in this repository. Fixed in #438.

fumoboy007 avatar Sep 09 '24 22:09 fumoboy007

I think the existing print statements might be leftovers from way back. The preferred way to fix this issue should probably be to utilize the preconfigured logger from services.utils wherever possible.

from services.utils import logging

logger = logging.getLogger("ComponentName")
...

logger.info("some important message")

some of the subprocess prints for the cache explicitly flush though so they should not be affected by the issue.

saikonen avatar Oct 07 '24 16:10 saikonen