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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:37+00:00 2026-05-27T01:22:37+00:00

I am trying to do simple file logging config in pyramid, with python 2.7.2

  • 0

I am trying to do simple file logging config in pyramid, with python 2.7.2 and pyramid 1.2.3

It isn’t working at all how I expected. It looks like even though i’m bootstrapping into pyramid, it isn’t loading the right logs. Specific problems below within test.py:

test.py

from pyramid.paster import bootstrap
env = bootstrap('../test.ini')

import logging
logging.basicConfig()  #this apparently makes no difference
log=logging.getLogger('root') #same thing if I do getLogger(__name__) - it doesn't find the proj one.
print log.handlers
>>> []

That’s weird! no handlers? Apparently it’s not the log I am thinking of.

print log

>>> logging.Logger

shouldn’t it be a RootLogger?

print log.parent

>>> [<logging.RootLogger>]

hmm so the parent of getLogger(‘root’) is the real RootLogger? let’s see what its handlers are:

print log.parent.handlers

>>> [<logging.StreamHandler>]

that’s weird.

test.ini:

[app:proj]
use = egg:proj
sqlalchemy.url = mysql+mysqldb://proj_staging:pw@localhost/proj_staging?charset=utf8
# This apparently helps avoid mysql gone away errors
sqlalchemy.pool_recycle = 3600

[pipeline:main]
pipeline = proj

[loggers]
keys = root, proj

[handlers]
keys = console, file

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = file
qualname=root

[logger_proj]
level = DEBUG
handlers = 
qualname = proj

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[handler_file]
class = FileHandler
args=('../logs/proj.log','a')
formatter = generic
level = INFO

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
  • 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-27T01:22:38+00:00Added an answer on May 27, 2026 at 1:22 am

    Pyramid doesn’t load the logging configuration when bootstrapping. If you want to make an argument that it should, please open a ticket at https://github.com/Pylons/pyramid/issues

    Regardless, it’s pretty simple to load the logging information yourself:

    import logging
    import logging.config
    from pyramid.paster import bootstrap
    logging.config.fileConfig('../test.ini')
    env = bootstrap('../test.ini')
    
    log = logging.getLogger(__name__)
    log.debug('foo')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a simple file enc/decryption within a larger project. I'd like
I'm trying to test using a TimedRotatingFileHandler with a logging.config file, nothing that complicated
I'm trying to run a c++ 2d array (pretty simple file) and it works
I have a really simple XML file that I'm trying to read, but I
I'm trying to load a simple Xml file (encoded in UTF-8): <?xml version=1.0 encoding=UTF-8?>
I'm trying (and failing) to write a simple template file: <#@ template language=C# hostspecific=True
i have a simple xml file in a wcf service that i am trying
Very confused here, trying out the yuicompressor on a simple javascript file. My js
I'm trying to write a simple ruby script that will copy a file to
I have another csv file where I am trying to do a simple word

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.