Using Python module 'logging' with docker

Viewed 168

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.

0 Answers
Related