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


Groups > comp.lang.python > #40860

Missing logging output in Python

Newsgroups comp.lang.python
Date 2013-03-08 06:07 -0800
Message-ID <b570d558-706d-4d2d-af81-41c44e2a3a21@googlegroups.com> (permalink)
Subject Missing logging output in Python
From gabor.a.halasz@gmail.com

Show all headers | View raw


Hi,

I would like to enable loggin in my script using the logging module that comes with Python 2.7.3.

I have the following few lines setting up logging in my script, but for whatever reason  I don't seem to get any output to stdout  or to a file provided to the basicConfig method.

Any ideas?

# cinfiguring logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)8s %(message)s',
                    datefmt='%Y-%m-%d\t%H:%M:%s', filename=config["currentLoop"], filemode='a')
# define a Handler that writes INFO messages to sys.stderr
console = logging.StreamHandler()
console.setLevel(logging.INFO)
# set format that is cleaber for console use
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
# tell the handler to use this format
console.setFormatter(formatter)
# add the handler to the root logger
logging.getLogger('').addHandler(console)

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


Thread

Missing logging output in Python gabor.a.halasz@gmail.com - 2013-03-08 06:07 -0800
  Re: Missing logging output in Python "W. Matthew Wilson" <matt@tplus1.com> - 2013-03-12 07:33 -0400

csiph-web