Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:59:37+00:00 2026-05-31T22:59:37+00:00

The following code is used to fetch logs from app engine for further processing.

  • 0

The following code is used to fetch logs from app engine for further processing. However I do not know how to use the result of logservice.fetch to access log messages now??

import cgi
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.api.logservice import logservice
logservice.AUTOFLUSH_ENABLED = False

class MainPage(webapp.RequestHandler):
    def get(self):  
        requestlogs = logservice.fetch(start_time=1332200000, end_time=1332249954, offset=None, minimum_log_level=logservice.LOG_LEVEL_INFO, include_incomplete=False, include_app_logs=True, version_ids=None, batch_size=None)
        self.response.out.write(requestlogs)
        c=0
        for iter in requestlogs:
           c=c+1  
        print c
application = webapp.WSGIApplication([('/logs', MainPage)], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:59:38+00:00Added an answer on May 31, 2026 at 10:59 pm

    In your case, the code would look something like this:

    from google.appengine.api import logservice
    
    MAX_LOGS_TO_READ = 10
    
    class MainPage(webapp.RequestHandler):
    
      def get(self):  
        request_logs = logservice.fetch()
        current_log = 0
        for log in request_logs:
          if current_log > MAX_LOGS_TO_READ:
            break
        self.response.out.write(log.combined)
    

    A couple of comments..

    • Use self.response.out.write() to write data to the response output stream.
    • fetch() returns an iterator of RequestLog objects. You can use this iterator then in a for loop to go over the set of logs the iterator knows about.
    • RequestLog objects return a number of attributes, which are mostly documented here: http://code.google.com/appengine/docs/python/logservice/requestlogclass.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following piece of code is used to print the time in the logs:
I used the following code to display the event details fetched from the database.
The following code adds tasks that perform some processing on files from the blobstore,
I am trying to fetch content from following page with JSOUP: http://www.exchangeandmart.co.uk/used-cars-for-sale But it
I wrote code in which .getJSON api from jquery is used to fetch images
I swear the following code used to work, even in IE7 but now i
here the following code is used to view the present modal view controller. [[self
i have used following code to repeat a process creation/close iteratively dim vProcessInfo as
I have used following code to create a simple PDF file. It executes fine
The following code is being used to disable a Submit button once it has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.