Sunday, June 28, 2020

Re: How to configure a DatagramHandler for logging?

Correction, the line that says 'logging.handlers.DatagramHandler', really reads 'logging.DatagramHandler' in the code I'm running. The logging.handlers.DatagramHandler was just something I tried to see what it would do.



> On Jun 28, 2020, at 9:17 PM, Roy Smith <roy@panix.com> wrote:
>
> Python 3.7.3
> Django 2.2.13
> Debian Linux
>
> I'm trying to configure a DatagramHandler for logging. My LOGGING config is:
>
> LOGGING = {
> 'version': 1,
> 'disable_existing_loggers': False,
> 'handlers': {
> 'file': {
> 'level': 'DEBUG',
> 'class': 'logging.FileHandler',
> 'filename': os.path.join(LOG_DIR, 'django.log'),
> },
> 'netcat': {
> 'level': 'DEBUG',
> 'class': 'logging.handlers.DatagramHandler',
> 'host': 'xxxxx',
> 'port': 23001,
> },
> },
> 'loggers': {
> 'django': {
> 'handlers': ['file'],
> 'level': 'DEBUG',
> 'propagate': True,
> },
> },
> }
>
> When django starts, I get:
>
> AttributeError: module 'logging' has no attribute 'DatagramHandler'
>
> Sure enough, if I look in.../lib/python3.7/logging/__init__.py, there is no DatagramHandler. So what am I supposed to do?
>
> I suspect this is more of a Python question than a Django question, but I figured I'd start here and work my way up :-)
>
>
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0AE03550-BE78-48A0-A42F-D5A05FF9D42D%40panix.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/77CAEE05-D836-4FF1-A653-A7389B7B06CE%40panix.com.

No comments:

Post a Comment