简体   繁体   中英

python logger in docker is not working

I am trying to use my python app on docker. I'm using a package called autologging which is actually using python's logging library.

When I use my app inside a docker container it prints out the sys prints but not the ones generated by the logger.

I have tried to define the following in the compose.yml file and it's still not working:

stdin_open: True
tty: True
privileged: True
cap_add: 
 - "ALL"
environment: 
 - PYTHONUNBUFFERED=0   

I also tried the -u option.

The autologging module uses Python's standard logging module. As such, it is governed by the same configuration settings. If you are simply not seeing any log output, please make sure that you are configuring logging appropriately for the application. (I myself am not familiar with Docker; it may simply be the case that the root logger is by default suppressing the log entries.)

If you haven't explicitly configured logging for your application, please refer to the Python documentation here . If you have explicitly configured logging for your application, please provide details (there is an open issue to track this at https://github.com/mzipay/Autologging/issues/1 ).

(Note: I am the author of autologging.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM