3

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.

David Underhill
  • 15,896
  • 7
  • 53
  • 61
jpswain
  • 14,642
  • 8
  • 58
  • 63

1 Answers1

1

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.

David Underhill
  • 15,896
  • 7
  • 53
  • 61
  • Hey thanks, I think Solution 1 will work for me. I was really hoping for something like log4j where I could set the root logger to "debug" and then override the package/folder containing dev_appserver setting it to "error". – jpswain Dec 02 '10 at 04:08
  • 2
    Btw, where in my code should I tell the library logging.setLevel(logging.ERROR) or whatever. Is there a callback for onApplicationStart or something like that that will apply it to all of app engine so that I can selectively override it? Thanks – jpswain Dec 05 '10 at 19:30