In my Django project I have a file called views.py. There are a couple of logging/print statements there, which work fine.
However, views.py calls another python script using subprocess’s run method. Surprisingly, no logging/print statements work in that script. This is how run() is being called:
out= run([sys.executable, /path/to/script.py, param1, param2], shell=False, stdout=PIPE)
Logging is configured like this in settings.py:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'class': 'logging.StreamHandler',
},
},
'loggers': {
'my_logger': {
'handlers': ['console'],
'level': 'INFO',
},
},
}
Please advise what is going wrong.
Thanks.
Aucun commentaire:
Enregistrer un commentaire