all day.
plz tell me problem. not print log message factory
#!/usr/bin/env twistd --pidfile=storage_monitor.pid --logfile=./logs/storage_twistd.log -ny twisted.python import log .... class redismonitorprotocol(redis.subscriberprotocol): def connectionmade(self): print "p", datetime.datetime.now() log.msg("waiting messages...") .... class redismonitorfactory(redis.subscriberfactory): maxdelay = 120 protocol = redismonitorprotocol def __init__(self, conf): print "f",datetime.datetime.now() log.msg("+++++++++++++++++++++++++test1...") print "f",datetime.datetime.now() out in stdout
f 2015-07-09 14:03:37.039811 f 2015-07-09 14:03:37.039876 i see in log file "waiting messages..." , "p 2015-07-09 14:03:37.130076"
your factory constructed (its __init__ called) before logging initialized; logging starts once server components built , passed application service, can print messages administrator interactively before log file consumes stdio. means log.msg calls don't go anywhere. if log in other methods of factory such buildprotocol see log messages in log file expect. in other words has when code run (before or after log file opened) rather where code declared (what class it's on).
Comments
Post a Comment