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


Groups > comp.lang.python > #81195

Python Logging and printf()

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ganesh1pal@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:Python': 0.06; 'debug': 0.07; 'skip:% 20': 0.09; 'subject:()': 0.09; 'python': 0.11; 'subject:Logging': 0.16; 'module': 0.19; 'input': 0.22; 'file.': 0.24; 'logging': 0.26; 'shown': 0.26; 'required.': 0.27; 'message-id:@mail.gmail.com': 0.30; 'file': 0.32; '(2)': 0.35; 'etc': 0.35; 'received:google.com': 0.35; '8bit%:17': 0.36; '8bit%:9': 0.36; 'application': 0.37; 'level': 0.37; '8bit%:4': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'ensure': 0.60; 'logged': 0.60; 'guarantee': 0.63; 'provide': 0.64
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lDCaf3oG5MR4+N3bPk675WXeoMWozMisxxeqwD6HI0E=; b=eM5DpdUDJtSd+HslUzegpdeom4ZxhYTzAQ3Lx4cV1GZO+5BZJCmF2M4pXAddEW/uOj 5NLGY9/e7iyFlTQv0FGLtoOBp/QDasAKrJZqoGm7H5auMqclXVmNBO19qG7Da7IFt9Mf OjrCIqYkLRlHWARil4Ul0JYBQfoQ19lejKJMLSUV02nIUIb4G1fLme/cWSSTMNnbTsZu jVL58CD6mMf1ip2unlrkcSeE49T23xqa7PdZGdsgs0IT1RMr5aMWqpF9yeH6hE0A3sq7 HR0g0nGvx8AB02LNKY8neRTe+LvkB80nqN1ZGxXHU6DQDWjJGGP87QDCFLuSUHLgBUzm 6hwA==
MIME-Version 1.0
X-Received by 10.152.3.229 with SMTP id f5mr2474797laf.94.1416566883188; Fri, 21 Nov 2014 02:48:03 -0800 (PST)
Date Fri, 21 Nov 2014 16:18:03 +0530
Subject Python Logging and printf()
From Ganesh Pal <ganesh1pal@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=089e013d182adf873705085c2d6a
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.16095.1416567208.18130.python-list@python.org> (permalink)
Lines 75
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1416567208 news.xs4all.nl 2908 [2001:888:2000:d::a6]:60217
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 6745
X-Received-Body-CRC 762841953
Xref csiph.com comp.lang.python:81195

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi Team ,

Iam using the python logging module to log the events for my application
into a log file .

I have set the logging level to DEBUG  as shown below

logging.basicConfig(filename=options.log_file,
                        level=logging.DEBUG,
                        format='%(asctime)s %(levelname)s:%(message)s',
                        datefmt='%m/%d/%Y %I:%M:%S %p')

 iam also using logging.warning(),logging.error(),logging.info() etc  as
and when required.

Please provide your input on the below questions.

(1). How do i guarantee that  all console messages will be logged into the
logfile ?
(2) I feel the  need to retain few print(), how do I ensure the print()
messages are also logged into the log file.



Regards,
Ganesh

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


Thread

Python Logging and printf() Ganesh Pal <ganesh1pal@gmail.com> - 2014-11-21 16:18 +0530

csiph-web