Disable Application Logging

I use Appstats as described here:

http://code.google.com/appengine/docs/python/tools/appstats.html

It works fine, but every request now logs an informational message like this:

Saved; key: appstats : 039300, part: 65 bytes, full: 12926 bytes, overhead: 0,000 + 0,004; link: http://example.com/stats/details?time=1290733239309

Is there a way to turn off log messages while leaving Appstats running?

Maybe I can just take my own copy of ext / appstats / record.py and comment on the call to logging.info ()? Or is there a better way?

Thanks.

+4
source share
3 answers

You can look at an example appstats configuration file . You can configure appstats to only a percentage of your requests; which should reduce the number of registration messages, but you will still have information.

If you want to update your applets, you should take a look at line 303 in /google/appengine/ext/appstats/recording.py . If you use webapp, it’s very simple to just appaats monkey-patch , replacing its save method with your _save method.

Also send a request and post a link to the groups. I think the ability to disable the log call is a valid request; they tend to bother magazines a bit.

+6
source

In case anyone else is interested, here's how I deleted the log using Robert monkey-patch's suggestion.

The standard approach for inserting appstats is as follows:

 def webapp_add_wsgi_middleware(app): from google.appengine.ext.appstats import recording app = recording.appstats_wsgi_middleware(app) return app 

Here is what I did instead:

 def webapp_add_wsgi_middleware(app): from google.appengine.ext.appstats import recording def save(self): try: self._save() except Exception: pass recording.Recorder.save = save app = recording.appstats_wsgi_middleware(app) return app 

This saves the original save () function "ignore all exceptions", but deletes all entries around it.

+6
source

Posted by Appstats. Why do you want to disable logging? I am not saying that you should not - I'm just surprised that you want to disable it, because I do not understand your reason. If this is a reasonable use case, we can simply add a configuration flag to disable it.

+2
source

All Articles