logdna / logdna-cli

The LogDNA CLI allows you to signup for a new account and tail your server logs right from the command line.
https://logdna.com
MIT License
27 stars 21 forks source link

Django and LogDNA, server seems to be getting stuck #55

Open Montana opened 2 years ago

Montana commented 2 years ago

Hey LogDNA,

It could be my configuration but when trying to use LogDNA and Django, the server seems to get stuck. Here's some cursory information:

import logging
from logdna import LogDNAHandler

    LOGGING = {
        'version': 1,
        'disable_existing_loggers': False,
        'formatters': {
            'verbose': {
                'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s]" +
                        "%(message)s",
                'datefmt': "%d/%b/%Y %H:%M:%S"
            },
            'color': {
                '()': 'colorlog.ColoredFormatter',
                'format': '%(log_color)s%(asctime)s %(levelname)-8s %(name)s %(module)s  %(pathname)s:%(lineno)s%(reset)s \n\r\t %(message)s',
                'datefmt': "%d/%b/%Y %H:%M:%S",
                'log_colors': {
                    'DEBUG': 'cyan',
                    'INFO': 'green',
                    'WARNING': 'yellow',
                    'ERROR': 'red',
                    'CRITICAL': 'red,bg_white',
                }
            }
        },
        'filters': {
            'require_debug_true': {
                '()': 'django.utils.log.RequireDebugTrue',
            },
        },

        'handlers': {
            'console': {
                'level': 'DEBUG',
                'filters': ['require_debug_true'],
                'class': 'logging.StreamHandler',
                'formatter': 'color'
            },
            'logdna': {
                'level': logging.DEBUG,
                'class': 'logdna.LogDNAHandler',
                'key': "my_secret_key",
                'options': {
                    # 'app': '<app name>',
                    # 'env': "alpha",
                    'index_meta': True,
                },
            },
        },

        'loggers': {
            '': {
                'level': logging.DEBUG,
                'handlers': ['logdna'],
                'propagate': True,
            },
        }
    }

I am using the above example for Django logging using LogDNA. But when I'm running a Django server, it's getting stuck. For reference I'm using this as a guide.