我正在调用一个扭曲的python程序:
twistd -l twisted.log -y controller.py
基于我读过的所有文档:
代替:
有人可以指出我正确的方向吗?感谢。
编辑:
tac包含:
from twisted.internet import protocol, reactor
from twisted.application import service
application = service.Application('myapp daemon')
dbUpdateService= DbUpdater_UpdateService()
dbUpdateService.setServiceParent(application)
dbUpdateService.startService()
# repeat with 3x services
reactor.run()
答案 0 :(得分:1)
看起来你似乎没有使用twistd
。
-y
选项读取.tac
文件,而不是.py
文件。从技术上讲,.tac
也是Python源代码,但它有一些额外的规则,它不应该是一个模块。有一些解释here。-l
选项从twisted.python.log
发送输出,而不是logging
。controller.py
中做了你不应该做的随机游戏(该文件在守护进程之前执行),但是你没有附加controller.py
所以我真的不知道。请提出更详细的问题,了解您将来的实际行动。如果您的应用程序没有任何代码,则上述内容主要是猜测。
答案 1 :(得分:1)
这可能无法解决守护程序问题,但是关于你的日志文件,你使用的是twisted.python.log吗?使用log.msg和log.err获取与日志相关的输出。 查看http://twistedmatrix.com/documents/current/core/howto/logging.html
如果你使用的是twistd,你也不需要调用log.startLogging。