Stucked with python logging module

Discussion in 'Python' started by sword, Nov 16, 2011.

  1. sword

    sword Guest

    I just scaned through the beginer's guide of logging module, but I
    can't get anything from console. The demo just like this:

    import logging
    logging.debug("This is a demo")

    Maybe I should do sth to put the log to stdout in basicConfig first?
    Thanks in advance
     
    sword, Nov 16, 2011
    #1
    1. Advertising

  2. On Wed, Nov 16, 2011 at 8:58 AM, sword <> wrote:
    > I just scaned through the beginer's guide of logging module, but I
    > can't get anything from console. The demo just like this:
    >
    > import logging
    > logging.debug("This is a demo")
    >
    > Maybe I should do sth to put the log to stdout in basicConfig first?


    Actually, the problem is not of the output location, but of the
    logging level. In the default configuration, logs at DEBUG level are
    suppressed. logging.basicConfig will be a simple way to change this.
    Are you following the logging documentation at
    http://docs.python.org/py3k/howto/logging.html#logging-basic-tutorial?
    This page is part of the documentation of the logging module, and is
    suitable for first-time logging module users.

    In your case, you can do this:

    import logging
    logging.basicConfig(level=logging.DEBUG)
    logging.debug("This is a demo")

    --
    regards,
    kushal
     
    Kushal Kumaran, Nov 16, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dreamcatcher

    !!!! I got stucked with this !!!!

    dreamcatcher, Sep 14, 2003, in forum: C Programming
    Replies:
    0
    Views:
    566
    dreamcatcher
    Sep 14, 2003
  2. dreamcatcher

    !!!! I got stucked with this !!!!! Question part

    dreamcatcher, Sep 14, 2003, in forum: C Programming
    Replies:
    2
    Views:
    994
    Emmanuel Delahaye
    Sep 14, 2003
  3. Replies:
    4
    Views:
    352
  4. Subha

    Why malloc get stucked?

    Subha, Dec 7, 2006, in forum: C++
    Replies:
    5
    Views:
    2,145
    Default User
    Dec 8, 2006
  5. aki

    i m stucked...

    aki, Apr 10, 2007, in forum: C++
    Replies:
    0
    Views:
    482
Loading...

Share This Page