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

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

Open
Plaoo opened this issue Feb 3, 2022 · 0 comments
Open

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

Plaoo opened this issue Feb 3, 2022 · 0 comments

Comments

@Plaoo
Copy link

Plaoo commented Feb 3, 2022

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

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