I was just looking at some logs and some of the errors logged without tracebacks, I work out it was when I wasn't passing the error object to log.err- Is this by design?<div><br></div><div>Here is some code which shows it logging and not logging the traceback</div>
<div><br></div><div><div>import os</div><div>from twisted.python import log</div><div>from twisted.python.logfile import DailyLogFile</div><div><br></div><div>logfile= DailyLogFile.fromFullPath(os.path.join(os.path.dirname(__file__),"error.log"))</div>
<div>log.startLogging(logfile)</div><div><br></div><div>def zero_error():</div><div> 1/0</div><div><br></div><div>def stack(x):</div><div> if not x:</div><div> zero_error()</div><div> else:</div><div> stack(x-1)</div>
<div><br></div><div>def work(x,pass_exception):</div><div> try:</div><div> stack(x)</div><div> except Exception as e:</div><div> log.err(e if pass_exception else None)</div><div><br></div><div>if __name__ == "__main__":</div>
<div> work(5,True) #Doesn't log traceback</div><div> work(5,False) #Does log</div></div>