Ignoring RootLogger while doing reopen_files #1427

rocknrollnerd opened this Issue Jan 9, 2017 · 0 comments


None yet

1 participant

rocknrollnerd commented Jan 9, 2017 edited


I've encountered what seems to be the instance of the old logrotate bug when despite of sending USR1-signal correctly after rotating gunicorn still continues to log to the old logfile. However, the issue seemed to occur with root (top-level) logger only.

My logging config looks somewhat like this:

    'version': 1,
    'disable_existing_loggers': False,
    'handlers': {
        'file_root': {
            'class': 'logging.FileHandler',
            'filename': '/var/log/myproject/main.log'
        'file_a': {
            'class': 'logging.FileHandler',
            'filename': '/var/log/myproject/a.log'
        'file_b': {
            'class': 'logging.FileHandler',
            'filename': '/var/log/myproject/b.log'
    'loggers': {
        '': {
            'level': logging.INFO,
            'handlers': ['file_root']
        'a': {
            'level': 'INFO',
            'handlers': ['file_a']
        'b': {
            'level': 'INFO',
            'handlers': ['file_b']

a and b loggers are rotated correctly, however '' (root) logger is not.

This seems to happen because loggers() function only returns child loggers, ignoring root logger itself. Could that be fixed just by adding something like return [logging.getLogger(name) for name in existing] + [root]?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment