[Twisted-Python] twisted.internet.error.CannotListenError: Couldn't listen on any:/dev/log: [Errno 98] Address already in use

sara bai sara.byh at gmail.com
Mon Apr 12 23:31:36 EDT 2010


hi all :

I have stoped rsyslog service , and the following program is used to listen
on 'dev/log'

after rsyslog stoped   type this command in shell  : $ logger write this
mesg to var/log/syslog

this msg can't write to var/log/syslog  anymore


after run  # python  devlog.py ,but i got an error like this :

* "  twisted.internet.error.CannotListenError: Couldn't listen on
any:/dev/log: [Errno 98] Address already in use " *


# ps aux|grep syslog

there is no syslog process runing

my system is ubuntu9.10    there is no process named syslogd --that's the
very process i want  make it stop


$ ps aux|grep syslog
root      4656  0.0  0.0   1852   548 ?        Ss   11:24   0:00 dd bs=1
if=/proc/kmsg of=/var/run/rsyslog/kmsg
syslog    4658  0.0  0.0  33184  1244 ?        Sl   11:24   0:00 rsyslogd
-c4
1000      4663  0.0  0.0   3040   800 pts/1    R+   11:24   0:00 grep
--color=auto syslog


# service rsyslog stop

$ ps aux|grep syslog

1000      4647  0.0  0.0   3040   800 pts/1    S+   11:24   0:00 grep
--color=auto syslog


this code is supose to makesure  logger still can write log message to
/var/log/syslog  after syslogd stoped



i don't know why  *Address already in use* since the rsyslog service is not
running anymore

I'm I stoped the wrong service ? or  listening on the wrong ** *unix socket
?*



need help   ...



# devlog.py

from twisted.internet.protocol import DatagramProtocol,  Factory
from twisted.internet import reactor


class LogProtocol(DatagramProtocol):
    def  datagramReceived(self,  datagram):
        sys.stdout.write(datagram)

class SysLogFactory(Factory):
    protocol = LogProtocol

logprotocol = LogProtocol()


reactor.listenUNIXDatagram('/dev/log', logprotocol)
reactor.run()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20100413/bbf78a16/attachment-0001.htm 


More information about the Twisted-Python mailing list