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 952841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:57:29+00:00 2026-05-15T23:57:29+00:00

I need some help understanding what’s happening here. This code is from a models/log.py

  • 0

I need some help understanding what’s happening here. This code is from a models/log.py module in web2py, and is meant to allow for global logging.

def _init_log(): 
    logger=logging.getLogger(request.application) 
    ...
    return logger 

logging=cache.ram('mylog',lambda:_init_log(),time_expire=99999999)

Can someone explain how this might work, and what the last line is doing?

Thanks–

  • 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-15T23:57:29+00:00Added an answer on May 15, 2026 at 11:57 pm

    This is not a standard web2py file. Sombody wrote it but I can see what it does:
    In web2py a single installation can run multiple apps. Some users want different app running under the same web2py to have separate logs, therefore they need different logger objects. In web2py there are not global settings and all user code is executed on every request so in order to avoid re-creating the logger at every request, the logger objects is created only ones and stores in cache with large expiration time 999…9. When an http request arrives, if it need to log, it finds the logger in cache. Look at the docs for cache.ram.

    I have used this trick but never for logging.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help understanding this bit of code pre { white-space: pre; white-space:
I need some help in understanding what is happening here .I am getting a
I'm brand new to python, and need some help understanding this code fragment: for
I need some help understanding some of the points from Paul Graham’s What Made
Need some help on understanding how to do this; I'm going to be running
I need some help in understanding a python concept. class TilePuzzleProblem(search.Problem): This class is
Need some help understanding the difference between the success and ajaxSuccess events documented here
I need some help understanding what I'm doing wrong with my js code. Basically
Need some help understanding if I'm on the right track here and exactly what
OK, I need some help understanding the process behind Facebook's website integration process and

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.