log file will be overwrite when use prefork?

42 views
Skip to first unread message

DanYun Liu

unread,
Aug 10, 2012, 12:14:26 AM8/10/12
to django...@googlegroups.com
below is the logging config in setting.py.  only the newest logs in the output file.. It seems the log file is overwrite when new process been forked 

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,

    'formatters': {
        'standard': {
            'format': '%(levelname)s %(asctime)s %(module)s %(lineno)d %(message)s'
        },
        'detail': {
            'format': '%(levelname)s %(asctime)s %(pathname)s %(lineno)d %(message)s'
        }
    },
    'handlers': {
        'frontend': {
            'level': 'INFO',
            'formatter': "standard",
            'class': 'logging.handlers.TimedRotatingFileHandler',
            'when': 'MIDNIGHT',
            'filename': '/deploy/logs/log.txt'
        },
        'error': {
            'level': 'INFO',
            'formatter': "detail",
            'class': 'logging.handlers.TimedRotatingFileHandler',
            'when': 'MIDNIGHT',
            'filename': '/deploy/logs/error.txt'
        },
        'stat': {
            'level': 'INFO',
            'formatter': "standard",
            'class': 'logging.handlers.TimedRotatingFileHandler',
            'when': 'MIDNIGHT',
            'filename': '/deploy/logs/stat.txt'
        }
    },
    'loggers': {
        'frontend': {
            'handlers': ['frontend'],
            'level': 'INFO',
            'propagate': True,
            },
        'error': {
            'handlers': ['error'],
            'level': 'INFO',
            'propagate': True,
            },
        'stat': {
            'handlers': ['stat'],
            'level': 'INFO',
            'propagate': True,
            },
        }
}



--
Pursuit the freedom of the soul.

Pengfei Xue

unread,
Aug 10, 2012, 2:08:12 AM8/10/12
to django...@googlegroups.com
you are using TimedRotatingFileHandle, so it will rotate your log into a new file with the name as xxx.20120810, and start store new entries in 'filename'( stat.txt, error.txt)

-- 
Sincerely,
Pengfei Xue





已使用 Sparrow

已使用 Sparrow
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply all
Reply to author
Forward
0 new messages