[Twisted-Python] Problem with twisted.web log files

Tommi Virtanen tv at twistedmatrix.com
Sat Apr 19 09:35:11 EDT 2003


On Thu, Apr 17, 2003 at 10:31:34AM -0400, Alex Levy wrote:
> I'm seeing some strange behavior from twisted.web.
> 
> After running "mktap web --logfile=web.log ; twistd -nf web.tap", I get the
                                     ^^^^^^^
> following traceback:
...
>   File "/home/mesozoic/dev/Twisted/twisted/web/server.py", line 408, in _openLogFile
>     return logfile.LogFile(os.path.basename(path), os.path.dirname(path))
                                                     ^^^^^^^^^^^^^^^^^^^^^ == ""

>   File "/home/mesozoic/dev/Twisted/twisted/python/logfile.py", line 107, in __init__
>     BaseLogFile.__init__(self, name, directory, defaultMode)
>   File "/home/mesozoic/dev/Twisted/twisted/python/logfile.py", line 38, in __init__
>     assert os.path.isdir(self.directory)
> AssertionError
> 
> This does _not_ happen, however, if I run "mktap web --logfile=./web.log"

	Which makes dirname be ".".

> This problem has only surfaced recently, although I can't say precisely how
> long ago.  I am using Twisted out of CVS.

1.64         (itamarst 28-Apr-02):     def _openLogFile(self, path):
1.67         (carmstro 27-May-02):         from twisted.python import logfile
1.64         (itamarst 28-Apr-02):         return logfile.LogFile(os.path.basename(path), os.path.dirname(path))
1.66         (acapnoti 26-May-02): 

	I believe it's been like that since the support for separate
	web access log was added. A quick and perlish fix would be in
	Twisted/twisted/web/server.py, line 408, in _openLogFile, to
	change:

-	return logfile.LogFile(os.path.basename(path), os.path.dirname(path))
+	return logfile.LogFile(os.path.basename(path), os.path.dirname(path) or '.')

-- 
:(){ :|:&};:




More information about the Twisted-Python mailing list