Changeset 9988 for main/waeup.kofa/trunk/src
- Timestamp:
- 24 Feb 2013, 13:42:04 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/utils
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/logger.py
r9769 r9988 76 76 import grok 77 77 import logging 78 from logging.handlers import WatchedFileHandler 78 79 from string import Template 79 80 from ulif.loghandlers import DatedRotatingFileHandler … … 215 216 216 217 # Create a rotating file handler logger. 217 handler = DatedRotatingFileHandler( 218 filename, when='MON', backupCount=BACKUP_COUNT) 218 handler = WatchedFileHandler( 219 filename, encoding='utf-8') 220 #handler = DatedRotatingFileHandler( 221 # filename, when='MON', backupCount=BACKUP_COUNT) 219 222 handler.setLevel(LEVEL) 220 223 formatter = logging.Formatter(self.logger_format_str) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_logger.py
r9283 r9988 162 162 self.assertEqual(len(result.handlers), 1) 163 163 handler = result.handlers[0] 164 #self.assertEqual(handler.maxBytes, MAX_BYTES) 165 self.assertEqual(handler.backupCount, BACKUP_COUNT) 164 if hasattr(handler, 'maxBytes'): 165 self.assertEqual(handler.maxBytes, MAX_BYTES) 166 if hasattr(handler, 'backupCount'): 167 self.assertEqual(handler.backupCount, BACKUP_COUNT) 166 168 self.assertTrue(result.propagate is False) 167 169 return … … 209 211 self.assertEqual(new_handler_num, 1) 210 212 self.assertTrue(isinstance( 211 212 logging.handlers.RotatingFileHandler))213 new_py_logger.handlers[0], 214 logging.handlers.WatchedFileHandler)) 213 215 214 216 class LoggersFunctionalTests(FunctionalTestCase): … … 254 256 handler = self.component.logger.handlers[0] 255 257 self.assertTrue(isinstance( 256 handler, logging.handlers.RotatingFileHandler)) 257 #self.assertEqual(handler.maxBytes, MAX_BYTES) 258 self.assertEqual(handler.backupCount, BACKUP_COUNT) 258 handler, logging.handlers.WatchedFileHandler)) 259 if hasattr(handler, 'maxBytes'): 260 self.assertEqual(handler.maxBytes, MAX_BYTES) 261 if hasattr(handler, 'backupCount'): 262 self.assertEqual(handler.backupCount, BACKUP_COUNT) 259 263 self.assertTrue(handler.baseFilename.endswith('logs/sample.log')) 260 264 return
Note: See TracChangeset for help on using the changeset viewer.