Skip to content

Django Logging not create log group, type error. #168

@Plaoo

Description

@Plaoo

Hi in my Django project I have implemented the log on Cloudwatch, but the parameter `` log_group_name``` gives me an error,

Invalid type for parameter logGroupNamePrefix, value: ('mylogname',), type: <class 'logging.config.ConvertingTuple'>, valid types: <class 'str'>

When in reality it is a string.

boto3_connect_session = boto3.client("logs", region_name=AWS_REGION_NAME)
AWS_LOG_GROUP = 'mylogname'
LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'formatters': {
        'aws': {
            'format': u"%(asctime)s [%(levelname)-8s] %(message)s [%(pathname)s:%(lineno)d]",
            'datefmt': "%Y-%m-%d %H:%M:%S"
        },
        'simple': {
            'format': '[%(asctime)s %(module)s] %(levelname)s: %(message)s'
        },
    },
    'handlers': {
        AWS_LOGGER_NAME: {
           'level': 'DEBUG',
           'class': 'watchtower.CloudWatchLogHandler',
           'boto3_client': boto3_connect_session,
           'log_group_name': AWS_LOG_GROUP,
           'formatter': 'aws',
       },
        'console': {
            'level': 'INFO',
            'class': 'logging.StreamHandler',
            'formatter': 'simple',
        },
    },
    'loggers': {
        AWS_LOGGER_NAME: {
            'level': 'DEBUG',
            'handlers': [AWS_LOGGER_NAME],
            'propagate': False,
        },
        'django': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': True,
        },
        '': {
            'handlers': ['console'],
            'level': 'INFO',
            'propagate': True,
        },
    },
}

Can you tell me how to solve it, obviously I don't want the logs to read watchtower

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions