Changeset 457:3f80c4282d20

Show
Ignore:
Timestamp:
08/01/08 16:46:11 (5 months ago)
Author:
"Brian Warner <warner@lothar.com>"
branch:
default
Message:

log-gatherer fix timed-rotator vs LoopingCall?(now=true)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ChangeLog

    r456 r457  
    112008-08-01  Brian Warner  <warner@lothar.com> 
     2 
     3        * foolscap/logging/gatherer.py (GathererService.do_rotate): oops, 
     4        implement the precautions claimed by the comment in startService: 
     5        test self._savefile before doing anything. 
     6        (GathererService.__init__): set self._savefile to None 
     7        * foolscap/test/test_logging.py (Gatherer.test_log_gatherer2): add 
     8        a timed rotator, which caught the problem in do_rotate 
    29 
    310        * foolscap/test/test_logging.py (IncidentGatherer.test_emit): add 
  • foolscap/logging/gatherer.py

    r454 r457  
    153153        if signal and hasattr(signal, "SIGHUP"): 
    154154            signal.signal(signal.SIGHUP, self._handle_SIGHUP) 
     155        self._savefile = None 
    155156 
    156157    def _handle_SIGHUP(self, *args): 
     
    181182 
    182183    def do_rotate(self): 
     184        if not self._savefile: 
     185            return 
    183186        self._savefile.close() 
    184187        now = time.time() 
  • foolscap/test/test_logging.py

    r456 r457  
    11561156 
    11571157    def test_log_gatherer2(self): 
    1158         # set log-gatherer-furl, then setLocation 
     1158        # set log-gatherer-furl, then setLocation. Also, use a timed rotator. 
    11591159        basedir = "logging/Gatherer/log_gatherer2" 
    11601160        os.makedirs(basedir) 
    11611161 
    11621162        # create a gatherer, which will create its own Tub 
    1163         gatherer = MyGatherer(None, False, basedir) 
     1163        gatherer = MyGatherer(3600, False, basedir) 
    11641164        gatherer.tub_class = GoodEnoughTub 
    11651165        gatherer.d = defer.Deferred()