3

I'm working on a project and have got into a weird issue.

This project is running in Docker, I have an image running Debian, with the Python project on it, the thing is I did a basic Logging config and whenever I should get the logging printed, It doesn't show anything nor modifies the log file. This is the config for the logging:

log.basicConfig(level=log.DEBUG,
            format='%(asctime)s: %(levelname)s [%(filename)s:%(lineno)s] %(message)s',
            datefmt='%I:%M:%S %p',
            handlers=[
                log.FileHandler('admin_logs.log'),
                log.StreamHandler()
            ])

I say it's weird for me because I tested this on my host PC (Windows) without running this on a docker image and it works perfectly.

PS: To check if there is anything logged on console I use:

docker logs -f mycontainerid

If I use print('something') it appears there, but doesn't work with loggings.

PS 2: I apologize for my english.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
arturo.p96
  • 31
  • 1
  • Please share your Dockerfile and [mcve] of the rest of the code that logs – OneCricketeer Nov 15 '21 at 19:54
  • might be a buffering issue? https://stackoverflow.com/questions/29663459/python-app-does-not-print-anything-when-running-detached-in-docker – Bakuriu Nov 15 '21 at 19:56
  • I tried modifying the buffering and nothing happened. Also, I'm going to try to make a minimal reproducible example, because I can't share the project to public, because of company policies – arturo.p96 Nov 15 '21 at 21:54

0 Answers0