[Twisted-Python] Change twisted logging
Nicolas D. Cesar
ncesar at lunix.com.ar
Wed Oct 11 14:30:25 MDT 2006
How can I supress the "Traceback (most recent call last)" when an uncaught
Exception rises up to twistd..?
I did:
-------------------------------------------------
originalLogger = log.theLogPublisher.observers.pop(0)
def emit(eventDict):
if eventDict["isError"]:
eventDict["message"] = ["[EE] " + x for x in eventDict["message"]]
global originalLogger
originalLogger(eventDict)
log.addObserver(emit)
--------------------------------------------------
and got:
-------------------------------------------------
2006/10/11 17:23 ART [-] [EE] Traceback (most recent call last):
2006/10/11 17:23 ART [-] [EE] File "/usr/bin/twistd", line 25, in ?
2006/10/11 17:23 ART [-] [EE] run()
2006/10/11 17:23 ART [-] [EE]
File "/usr/lib/python2.4/site-packages/twisted/scripts/twistd.py", line 205,
in run
[...]
2006/10/11 17:23 ART [-] [EE]
File "/u/home/ncesar/src-svn/twisted-tests/src/multiltsp/servers.py", line
375, in loadServers
2006/10/11 17:23 ART [-] [EE] raise
MandatoryConfig(os.path.join(os.getcwd(),servers_file),'main','servers')
2006/10/11 17:23 ART [-] [EE] multiltsp.servers.MandatoryConfig: ERROR: (..)
-----------------------------------------------
I just want to show the last line... not all the traceback info. Is this
posible?
Greetings,
--
Nicolás D. César <ncesar at lunix.com.ar>
Lunix S.R.L. -[ http://www.lunix.com.ar ]-
GnuPG Public Key: gpg --keyserver wwwkeys.pgp.net --recv-key 0x3606F3E6
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20061011/c4f69ac9/attachment.sig>
More information about the Twisted-Python
mailing list