Re: Logging handler: No output

Discussion in 'Python' started by Vinay Sajip, Sep 2, 2012.

  1. Vinay Sajip

    Vinay Sajip Guest

    Florian Lindner <mailinglists <at> xgm.de> writes:

    > But neither the FileHandler nor the StreamHandler produce any actual output.
    > The file is being created but stays empty. If I use a print output in the
    > while loop it works, so output is catched and the applications stdout in
    > working. But why the logger proclog catching nothing?
    >


    Paul Rubin's answer looks correct. In addition, you should note that every call
    to start_process will add a new handler to the logger (I can't tell if the
    logger could be the same on multiple calls, but it seems likely) and that may
    produce multiple messages. The rule of thumb is: most code should get loggers
    and log to them, but adding handlers, setting levels etc. should be only done in
    one place (typically invoked from a "if __name__ == '__main__'" clause.

    Regards,

    Vinay Sajip
    Vinay Sajip, Sep 2, 2012
    #1
    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. shruds
    Replies:
    1
    Views:
    737
    John C. Bollinger
    Jan 27, 2006
  2. Replies:
    1
    Views:
    680
    Damien
    Feb 22, 2007
  3. Replies:
    0
    Views:
    337
  4. Gal Aviel
    Replies:
    1
    Views:
    439
    Gerard Flanagan
    Mar 4, 2008
  5. Florian Lindner

    Logging handler: No output

    Florian Lindner, Sep 2, 2012, in forum: Python
    Replies:
    1
    Views:
    196
    Paul Rubin
    Sep 2, 2012
Loading...

Share This Page