简体   繁体   English

Django mod_python日志记录问题

[英]Django mod_python logging issue

I'm using Django with mod_python on remote server and need to add some logging. 我在远程服务器上将Django与mod_python一起使用,并且需要添加一些日志记录。 I try to add some test log, in settings.py I add this code: 我尝试在settings.py中添加一些测试日志,添加以下代码:

import logging

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='/home/voip_maker/django.log', filemode='a+')

logging.debug("hello world!")
logging.info("this is some interesting info!")
logging.error("this is an error!")

Then I restart apache and try to open my project via web, but there are no changes in log file. 然后,我重新启动apache并尝试通过Web打开我的项目,但是日志文件中没有任何更改。

Can you please help me with this issue, how I must configure logging to get changes in log file. 您能为我解决此问题(如何配置日志以获取日志文件中的更改)提供帮助吗?

Thanks very much, 非常感谢,

Django has made logging even simpler. Django使记录变得更加简单。 Please check the below docs: 请检查以下文档:

https://docs.djangoproject.com/en/1.4/topics/logging/ https://docs.djangoproject.com/zh-CN/1.4/topics/logging/

All you need to do is to add a dictionary to settings.py file 您需要做的就是将字典添加到settings.py文件中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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