python - django debug doesn't print set because of unicode chars (python3) -


update : i'm trying find example easy possible

hint! missed, 1 person isn't show on list too! , when changed it's name - ok - problem unicode char, if there's non-ascii char in string debug, logger doesn't print @ all. in python2 there error, in python3 unicode default doesn't thought - somehow doesn't work. if use logger.debug('1: %r' % ascii(suspected)) it's want <person: tadeusz koŚciuszko> instead of <person: tadeusz ko\\u015aciuszko>

  logger.debug('begin')   suspected = person.objects.all()   logger.debug('0')   try:     logger.debug('1: %r' % suspected)   except:     logger.debug('crash1')   sus in suspected:      logger.debug('2: %r' % sus)   try:     logger.debug('3: %r' % suspected)   except:     logger.debug('crash4')   logger.debug('end') 

result:

2016-01-16 08:53:54,665 debug views begin 2016-01-16 08:53:54,667 debug views 0 2016-01-16 08:53:54,938 debug views 2: <person: john smith> 2016-01-16 08:53:55,040 debug views 2: <person: george washington> 2016-01-16 08:53:55,222 debug views 2: <person: abraham lincoln> 2016-01-16 08:53:55,253 debug views 2: <person: paris hilton> 2016-01-16 08:53:55,282 debug views 2: <person: john wayne> 2016-01-16 08:53:55,368 debug views 2: <person: test test> 2016-01-16 08:53:55,700 debug views end 

and why there's no:

2016-01-16 08:53:54     debug views 1: [<person: john smith>, <person: george washington>, <person: abraham lincoln>, <person: paris hilton>, <person: john wayne>, <person: test test> 

and (if first doesn't show because it's lazy)

2016-01-16 08:53:55     debug views 3: [<person: john smith>, <person: george washington>, <person: abraham lincoln>, <person: paris hilton>, <person: john wayne>, <person: test test> 

or crash if wrong debug?

update leave whole example, next, because hard point, problem 1 letter - can others.

finally found!

http://codestrian.com/index.php/2015/06/26/a-guide-to-setting-up-django-logging-on-linux/

  'rotate_file':{             'level': 'error',             'class': 'logging.handlers.rotatingfilehandler',             'filename': os.path.join(base_dir, 'log/error.log'),             'formatter': 'verbose',             'maxbytes': 10485760,             'backupcount': 20,             'encoding': 'utf8'         }, 

and last line important: 'encoding': 'utf8'


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -