Code Monkey home page Code Monkey logo

Comments (12)

pudo avatar pudo commented on July 22, 2024

import logging

dataset_log = logging.getLogger("dataset")
dataset_log.setLevel(logging.WARNING)

from dataset.

zarino avatar zarino commented on July 22, 2024

Is that documented anywhere?

And why's it the default? I don't think I've ever seen a Python library where logging was opt-out rather than opt-in.

from dataset.

pudo avatar pudo commented on July 22, 2024

Ok, should probably flip it.

from dataset.

gka avatar gka commented on July 22, 2024

requests has debug messages enabled by default, too.

from dataset.

zarino avatar zarino commented on July 22, 2024

@gka Not that I've ever noticed. Are you sure?

from dataset.

gka avatar gka commented on July 22, 2024

http://stackoverflow.com/questions/11029717/how-do-i-disable-log-messages-from-the-requests-library

from dataset.

zarino avatar zarino commented on July 22, 2024

I stand corrected. Although I've still never seen any such messages in my use of requests.

The difference, I think, is that I can write something like this in a python file…

import requests
requests.get('http://httpbin.org/ip')
requests.post('http://httpbin.org/post', data={"foo": "bar"})

…and when I run it, I don't see any debugging cruft from requests. But if I write an equally simple file using dataset…

import dataset
db = dataset.connect('sqlite:///:memory:')
db["test"].insert({"foo": "bar"})

…I get a load of debug output. :-(

DEBUG:dataset.persistence.database:Creating table: test on Engine(sqlite:///:memory:)
DEBUG:dataset.persistence.table:Creating column: foo (<class 'sqlalchemy.types.UnicodeText'>) on 'test'

from dataset.

gka avatar gka commented on July 22, 2024

I think that 'feature' was introduced in a more recent version of requests. Maybe you have to update the package, current version is 1.2.3.

from dataset.

zarino avatar zarino commented on July 22, 2024

Ahh. I'm on 1.2.0. And to be honest, there's not much incentive to upgrade, if it means I'm going to have to prepend three lines of log-suppressing boilerplate to all my code :-/

from dataset.

fawkesley avatar fawkesley commented on July 22, 2024

requests 1.2.3 does not log by default.

I believe the culprit is line 11 of freeze/app.py:
logging.basicConfig(level=logging.DEBUG)

This is enabling logging at debug level for the global root logger (from which all loggers inherit) - that's why you're seeing logging output from requests.

From the docs at http://docs.python.org/2/library/logging.html#logging.basicConfig : "Does basic configuration for the logging system by creating a StreamHandler with a default Formatter and adding it to the root logger. The functions debug(), info(), warning(), error() and critical() will call basicConfig() automatically if no handlers are defined for the root logger."

from dataset.

abelsonlive avatar abelsonlive commented on July 22, 2024

After upgrading to the git version of dataset, this no longer seems to be a problem. Is there a way that you could push the new version to PyPI too?

from dataset.

pudo avatar pudo commented on July 22, 2024

Thanks for the poke, here we go: https://pypi.python.org/pypi?:action=display&name=dataset&version=0.3.9

from dataset.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.