Question

Does anyone know how to reduce the verbosity of logging output from dev_appserver.py?

The noise level of these logs is just driving me crazy. I know how to do this kind of config in Java with log4j, but am really lost here on google app engine python.

Was it helpful?

Solution

Solution 1.

You can instruct the logging library to only log statements at or above a given level with logging.setLevel(). If you set this level threshold higher than the level which contains the messages you don't want then you'll filter out the unwanted messages from dev_appserver.

To make your log messages show up, you need to do one of the following:

  • Ensure your logging messages are logged at least at the filtering out threshold you set above (probably WARN).
  • Configure and use your own custom logger. Then you can control the logging level for your logger independently of the root logger used by the dev server.

Solution 2.

The workaround above is a little annoying because you either have to avoid DEBUG and INFO levels, or you have to use create your own logger.

Another solution is to comment out the offending log messages from dev_appserver.py (and related modules). This would be quite a pain to do by hand, but I've written a tool which replaces logging calls in all files in a given folder (and its subfolders) - check out my post Python logging and performance: how to have your cake and eat it too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top