Ignore:
Timestamp:
22 May 2012, 23:30:17 (12 years ago)
Author:
uli
Message:

Use DatedRotatingFileHandler? for logging.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/logger.py

    r7811 r8492  
    7777import logging
    7878from string import Template
     79from ulif.loghandlers import DatedRotatingFileHandler
    7980from zope import schema
    8081from zope.component import queryUtility
     
    8485from waeup.kofa.utils.helpers import get_current_principal
    8586
    86 #: Default logfile size (5 KB)
     87#: Default logfile size (5 KB, not relevant for DatedRotatingFileHandlers)
    8788MAX_BYTES = 5 * 1024 ** 2
    8889
    89 #: Default num of backup files (5)
    90 BACKUP_COUNT = 5
     90#: Default num of backup files (-1 = indefinite)
     91BACKUP_COUNT = -1
    9192
    9293#: Default logging level (`logging.INFO')
     
    212213
    213214        # Create a rotating file handler logger.
    214         handler = logging.handlers.RotatingFileHandler(
    215             filename, maxBytes=MAX_BYTES, backupCount=BACKUP_COUNT)
     215        handler = DatedRotatingFileHandler(
     216            filename, when='MON', backupCount=BACKUP_COUNT)
    216217        handler.setLevel(LEVEL)
    217218        formatter = logging.Formatter(
Note: See TracChangeset for help on using the changeset viewer.