[google-appengine] Re: logging level

2009-03-14 Thread Doug

Hi Adam,

I have not tried this in GAE, but you should be able control the
logging level (and a whole lot more) in all of your scripts via a
single configuration file.  You will have to add a line to all of your
scripts that point to the file, but after that the logging level is
controlled by that configuration file.  (One change to the
configuration file and a redeploy would change the logging in all of
your scripts.)

Take a look at this site for information on how to do this:
http://docs.python.org/library/logging.html

On the performance/overhead question - I usually try to limit any
logging statements that would log large amounts of information to
except code blocks in my production code.  My logic behind that is
that if the code has already had an exception that the user experience
is already diminished, so taking a bit of extra time to make sure that
I have the documentation to fix the problem is beneficial to their
future experience.

Hope this helps.

Doug





On Mar 14, 8:39 am, Adam adamsplug...@gmail.com wrote:
 Any guidelines for how much logging we want to leave in our production
 code?

 specifically:

 - is the overhead of debug logging significant enough to worry about

 - is there an easy way to disable log messages below a certain level
   - do I need to do this in every script file, or is there something I
 can do inside app.yaml
   - is this significantly less efficient than removing the log calls
 (e.g. how fast does it short-circuit)

 - do any of these answers change based on how active the app is.  e.g.
 the log call itself may be efficient, but when the amount of data
 being logged becomes large I could imagine that the infrastructure
 code to clean up old records to free up space could be non-trivial and
 have some performance impacts

 thanks,
 Adam
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: logging level

2009-03-14 Thread Bastian Hoyer


you can just do somthing like that in your main application file:


def main():
logging.getLogger().setLevel(logging.DEBUG)
run_wsgi_app(application)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: logging level

2009-03-14 Thread Ken Tidwell

I was curious about logging load, as well, so I ran a few small tests.

It looks like it costs around 0.25 milliseconds per log call on the
production server. Which is not free but is very cheap.

But I also noticed that the development server takes a dive if you log
more than around 500 times in response to a single request. Haven't
investigated why that might be but it did explain some puzzling hangs
I had when debugging over-logged code.

The production server has no such issues and happily logged as many as
10,000 times in a single request. The load time rose to around 0.4
milliseconds per log in this test, though.

I was also duly chastised in the log entry for using so much CPU in a
single request. I'm still puzzling over the CPU usage claims. This
10,000 log entries test seems to complete in around 0.786 seconds wall
clock time (using Pythons time module to record start and end time of
the request then taking the difference) but is charged 3948ms in CPU.
Which seems odd.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---