1

How can I fix default log formatting from Google App Engine?

Every my line is added not need new line - it makes log double less readable - since I see half of lines. It occur when I am using standard logging module without any customization.

import logging
logging.debug('Something')
logging.debug('Something')
logging.debug('Something')
DEBUG    2016-04-16 09:29:24,338 filtered_keyword_idea_root_cause.py:26] Type  has 28379 objects.

DEBUG    2016-04-16 09:29:24,338 filtered_keyword_idea_root_cause.py:26] Type  has 13113 objects.

DEBUG    2016-04-16 09:29:24,338 filtered_keyword_idea_root_cause.py:26] Type  has 12948 objects.

DEBUG    2016-04-16 09:29:24,338 filtered_keyword_idea_root_cause.py:26] Type  has 5982 objects

When Google App engine log internal things there is not problem - what adds such irritating new lines?

DEBUG    2016-04-16 11:29:22,711 api_server.py:277] Handled datastore_v3.RunQuery in 0.0080
DEBUG    2016-04-16 11:29:22,720 api_server.py:277] Handled memcache.Get in 0.0010
DEBUG    2016-04-16 11:29:22,726 api_server.py:277] Handled memcache.Get in 0.0000
DEBUG    2016-04-16 11:29:22,746 api_server.py:277] Handled memcache.Get in 0.0010
DEBUG    2016-04-16 11:29:22,750 api_server.py:277] Handled memcache.Get in 0.0010

I want to achieve format like this above.

Chameleon
  • 9,722
  • 16
  • 65
  • 127
  • I tried with sample of your example, but didn't get extra new line between each line, that is to say, I've set `--log_level=debug` in running my script. Not sure if this is the reason of your issue, but thought worth to mention it for you. – Iron Fist Apr 16 '16 at 13:38
  • Try such environment `Windows XP/7` `Python 2.7.x` `--log_level=debug --dev_appserver_log_level=debug` `dev_appserver.py`. I have problem with empty lines from two years I think. – Chameleon Apr 16 '16 at 13:53
  • It's likely related to how the environment running the devserver interprets the CR, LF (or their combinations). Tweaking your app code to handle it may have negative impact on your live app deployed on GAE. I'd focus on adjusting the environment instead. – Dan Cornilescu Apr 16 '16 at 14:57
  • It will be nice to find responsible code for this artifacts. – Chameleon Apr 16 '16 at 18:11

0 Answers0