Hello all,
My login setup on my server does not enable console logging, only
to-file logging (see at the end of this message for the logger setup).
However, just now I got a unicode decode error in my logging:
File "/home/xyz/site/xyz/views.py", line 520, in xx_yy_zz
logger.error(u"Successfully decoded data but data is not json: %s"
% decoded)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb5 in position
1: ordinal not in range(128)
I'm a bit puzzled by this as I'm logging only to files, which should
be written as UTF-8...
If anyone has a clue, let me know!
greetings,
- bram
My logging setup:
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s %(levelname)-7s %(process)d
%(thread)d %(name)-20s ## %(message)s'
},
},
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse'
}
},
'handlers': {
'default': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': abs_path(os.path.join('logs', 'default.log')),
'maxBytes': 1024 * 1024 * 5, # 5 MB
'backupCount': 50,
'formatter': 'standard'
},
'db_handler': {
'level': 'DEBUG',
'class': 'logging.handlers.RotatingFileHandler',
'filename': abs_path(os.path.join('logs', 'django_db.log')),
'maxBytes': 1024*1024*5, # 5 MB
'backupCount': 50,
'formatter': 'standard',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'standard'
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'Site.custom_admin_logging.CustomAdminEmailHandler',
'formatter': 'standard',
}
},
'loggers': {
'': {
'handlers': ['default', 'mail_admins'],
'level': 'DEBUG',
'propagate': True
},
'django.request': {
'handlers': ['default', 'mail_admins'],
'level': 'WARNING',
'propagate': True,
},
'django.db.backends': {
'handlers': ['db_handler', 'mail_admins'],
'level': 'DEBUG',
'propagate': False,
},
}
}
--
http://www.samplesumo.com
http://www.freesound.org
http://www.smartelectronix.com
http://www.musicdsp.org
office: +32 (0) 9 335 59 25
mobile: +32 (0) 484 154 730
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.