Skip to content

Commit

Permalink
don't use http logs on Twisted-2.5.0
Browse files Browse the repository at this point in the history
Just fall back to the usual logging mechanism.  Verified on a F7 system.  Fixes buildbot#780.
  • Loading branch information
Dustin J. Mitchell committed Apr 9, 2010
1 parent 45cc731 commit e0947b8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions buildbot/status/web/baseweb.py
Expand Up @@ -350,14 +350,16 @@ def either(a,b): # a if a else b for py2.4
class RotateLogSite(server.Site):
def _openLogFile(self, path):
try:
# TODO: Use same log rotate parameters as twistd.log (from buildbot.tac)
from twisted.python.logfile import LogFile
log.msg("Setting up http.log rotating %s files of %s bytes each" %
(maxRotatedFiles, rotateLength))
return LogFile.fromFullPath(path, rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles)
if hasattr(LogFile, fromFullPath): # not present in Twisted-2.5.0
return LogFile.fromFullPath(path, rotateLength=rotateLength, maxRotatedFiles=maxRotatedFiles)
except ImportError, e:
log.msg("WebStatus: Unable to set up rotating http.log: %s" % e)
return server.Site._openLogFile(self, path)

# if all else fails, just call the parent method
return server.Site._openLogFile(self, path)

# this will be replaced once we've been attached to a parent (and
# thus have a basedir and can reference BASEDIR)
Expand Down

3 comments on commit e0947b8

@marcus-sonestedt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should probably move the log message from the except block as well, so it also triggers if hasattr() returns false.

@marcus-sonestedt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, thanks for fixing the 2.5.0 fallback. I thought I did that with the try..except clause, which I stole from my buildbot.tac, but obviously it wasn't correct.

@djmitche
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point re: log message. And no problem with fixing it .. finding a 2.5.0 installation isn't easy!

Please sign in to comment.