Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.06; 'debug': 0.07; 'skip:% 20': 0.09; 'subject:()': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'stored': 0.12; 'subject:Logging': 0.16; 'wrote:': 0.18; 'module': 0.19; 'input': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'module,': 0.24; 'file.': 0.24; 'software.': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'logging': 0.26; 'shown': 0.26; 'required.': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'url:mailman': 0.30; 'file': 0.32; 'url:python': 0.33; '(2)': 0.35; 'etc': 0.35; 'but': 0.35; 'there': 0.35; 'keyword': 0.36; 'url:listinfo': 0.36; 'url:org': 0.36; 'application': 0.37; 'level': 0.37; 'nov': 0.38; 'url:mail': 0.40; 'how': 0.40; 'ensure': 0.60; 'logged': 0.60; 'from:charset:utf-8': 0.61; 'guarantee': 0.63; 'provide': 0.64; 'to:addr:gmail.com': 0.65; 'url:be': 0.68; '2014,': 0.84; 'received:192.168.0.3': 0.84 X-Virus-Scanned: amavisd-new at example.com From: "=?utf-8?q?St=C3=A9phane?= Wirtel" To: "Ganesh Pal" Subject: Re: Python Logging and printf() Date: Fri, 21 Nov 2014 11:57:09 +0100 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (1.8r4587) Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416567946 news.xs4all.nl 2977 [2001:888:2000:d::a6]:39183 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81196 On 21 Nov 2014, at 11:48, Ganesh Pal wrote: > 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 ? There is no guarantee, it's a software. But all the log messages have to be stored in 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. the print function or print keyword don't use the logging module, you need to use it. > > > > Regards, > Ganesh > -- > https://mail.python.org/mailman/listinfo/python-list -- Stéphane Wirtel - http://wirtel.be - @matrixise