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


Groups > comp.lang.python > #35757

Re: Facing issue with Python loggin logger for printing object value

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'subject:Python': 0.05; 'debugging': 0.05; 'none,': 0.05; 'variable,': 0.07; 'python': 0.09; 'closest': 0.09; 'exited': 0.09; 'ignoring': 0.09; 'loop.': 0.09; 'none.': 0.09; 'threshold': 0.09; 'cc:addr:python-list': 0.10; 'exceptions.': 0.16; 'logger.': 0.16; 'said.': 0.16; 'subject:issue': 0.16; 'subject:object': 0.16; 'value"': 0.16; 'wrote:': 0.17; 'fix': 0.17; 'handles': 0.18; 'trying': 0.21; 'object.': 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'idea': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'logging': 0.27; 'functions.': 0.27; 'reply.': 0.28; 'case,': 0.29; 'maybe': 0.29; 'could': 0.32; 'goes': 0.33; 'null': 0.33; 'zero': 0.33; 'times.': 0.33; 'wrong': 0.34; 'thanks': 0.34; 'skip:l 30': 0.35; 'doing': 0.35; 'there': 0.35; 'list.': 0.35; 'explain': 0.36; 'but': 0.36; "didn't": 0.36; 'method': 0.36; 'anything': 0.36; 'subject:with': 0.36; 'bad': 0.37; 'execute': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'things': 0.38; 'gives': 0.39; 'received:192': 0.39; 'called': 0.39; 'received:192.168': 0.40; 'your': 0.60; "you'll": 0.62; 'ever': 0.63; 'here': 0.65; 'header:Reply-To:1': 0.68; 'lack': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'subject:printing': 0.84; 'subject:value': 0.84; 'aid,': 0.91
Date Sat, 29 Dec 2012 12:10:51 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To Morten Engvoldsen <mortenengv@gmail.com>
Subject Re: Facing issue with Python loggin logger for printing object value
References <CAJ2vgs6aDNFfrm+F7fRrBiE10naNQRKW_dwVGzM8BxCR9ws3Kw@mail.gmail.com> <50DF1D48.2060507@davea.name> <CAJ2vgs5j3+HYNWBd-3BN6p9hyDMG_5MmOrCKfodcMNzTg-OQUg@mail.gmail.com>
In-Reply-To <CAJ2vgs5j3+HYNWBd-3BN6p9hyDMG_5MmOrCKfodcMNzTg-OQUg@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:KXrr/Cf9QqlmCG1SF9sWPkhw3fJeDMVGjpZejVBvN6x RXvPXtgv4U5DsIPxKZKG/3C416MxQ/GKHoLuPXT1P0sMqOZU+D WD7udbreAODIhDTF6R7SuHnvjUL/8u6xB50KPKe7OqWnZM6gs6 +O6U0jgNjgs6FUCP0S+BKYbE67DvrAIOhratZTzv6bI7I53PzL zYNECkvR/QB6APXILnxIzMLqMbwsgxGrB/AO+foQ/BzURxTMZc KhJfodJ+y4xvMtvU+ZxLfN2mpPvv5Ux9p57s91XEjDCNCmsVKQ 9Inl5EGBi1HhnEchsjuR+BZe41GdZK9CsV+d+isEDxM5rO3Gg= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1431.1356801073.29569.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356801073 news.xs4all.nl 6971 [2001:888:2000:d::a6]:55814
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35757

Show key headers only | View raw


On 12/29/2012 11:54 AM, Morten Engvoldsen wrote:
> Hi Dave,
> Thanks a lot for your reply. I have used logging.setLevel(logger.DEBUG)
> because of threshold as you said.
> 
> I didn't copy paste the entire program since it was very huge. The "batch "
> which value i am trying to retrieve is in a a for loop :
> 
> for payment in payment_line:
> 
> but here payment_line has null value since it was not able to retrieve
> payment line value from the payment object. 

The closest thing Python has to "null value" is called None.  If
payment_line is None, then you'll get an exception on that loop.

As I said a while ago, I have no idea how openerp handles exceptions.
Maybe it's just doing a bare except, and ignoring anything that goes
wrong in your functions.  (Very bad practice)

It could be that payment_line is an empty list.  In that case, the loop
will execute zero times.  That would also explain the lack of output.

So if openerp gives you no debugging aid, then you may have to fake it
with the logger.  How about logging a simple message just before the loop?

logger.debug("value of payment_line is " + repr(payment_line))

Did you ever fix the other things wrong with that create method?  Like
using log.debug when the object was called logger?  Or incrementing
line_counter when there was no such variable, and when it would vanish
when you exited the method anyway?



-- 

DaveA

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


Thread

Re: Facing issue with Python loggin logger for printing object value Dave Angel <d@davea.name> - 2012-12-29 12:10 -0500

csiph-web