Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28277

Re: Logging handler: No output

From Vinay Sajip <vinay_sajip@yahoo.co.uk>
Subject Re: Logging handler: No output
Date 2012-09-02 17:02 +0000
References <3165391.mTzesgFQhr@horus>
Newsgroups comp.lang.python
Message-ID <mailman.92.1346605345.27098.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Logging handler: No output Vinay Sajip <vinay_sajip@yahoo.co.uk> - 2012-09-02 17:02 +0000

csiph-web