Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to ignore message when using json logging #14

Open
crccheck opened this issue Apr 19, 2018 · 1 comment
Open

Document how to ignore message when using json logging #14

crccheck opened this issue Apr 19, 2018 · 1 comment

Comments

@crccheck
Copy link
Owner

message is inferior to the extra context, so eliminate it so simplify output

@crccheck
Copy link
Owner Author

sample:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'json': {
            'format': '%(asctime)s %(message)s %(name)s %(levelname)s',
            'class': 'pythonjsonlogger.jsonlogger.JsonFormatter',
        },
        'obj_update': {
            'format': '%(asctime)s %(name)s',
            'class': 'pythonjsonlogger.jsonlogger.JsonFormatter',
        },
    },
    'handlers': {
        'console': {
            'class': 'project_runpy.ColorizingStreamHandler',
            'formatter': 'json',
            'level': env.get('LOG_LEVEL', 'DEBUG'),
        },
        'obj_update': {
            'class': 'logging.StreamHandler',
            'formatter': 'obj_update',
            'level': env.get('LOG_LEVEL', 'DEBUG'),
        },
    },
    'loggers': {
        'root': {
            'level': 'DEBUG',
            'handlers': ['console'],
        },
        'apps': {
            'level': 'DEBUG',
            'handlers': ['console'],
        },
        'obj_update': {
            'level': 'DEBUG',
            'handlers': ['obj_update'],
        },
    },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant