Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.81.MISMATCH!newsfeed.xs4all.nl!newsfeed2.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'exception': 0.03; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'debugging': 0.05; 'none,': 0.05; 'dev': 0.07; 'variable,': 0.07; 'python': 0.09; '"': 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; 'dec': 0.15; 'sat,': 0.15; 'exceptions.': 0.16; 'logger.': 0.16; 'of\xa0': 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; '\xa0if': 0.22; 'help.': 0.22; 'cc:2**0': 0.23; '>': 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; 'am,': 0.27; 'logging': 0.27; 'functions.': 0.27; 'message- id:@mail.gmail.com': 0.27; 'fixed': 0.28; 'reply.': 0.28; 'declared': 0.29; 'lot.': 0.29; 'case,': 0.29; 'maybe': 0.29; 'could': 0.32; 'goes': 0.33; 'null': 0.33; 'zero': 0.33; 'times.': 0.33; 'received:google.com': 0.34; 'wrong': 0.34; 'thanks': 0.34; 'skip:l 30': 0.35; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'list.': 0.35; 'really': 0.36; '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; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'skip:l 20': 0.38; 'things': 0.38; 'gives': 0.39; 'called': 0.39; 'header:Received:5': 0.40; 'your': 0.60; "you'll": 0.62; 'ever': 0.63; 'great': 0.64; 'here': 0.65; 'lack': 0.71; 'subject:printing': 0.84; 'subject:value': 0.84; 'aid,': 0.91; 'angel': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=GoQ6nTjKVUIngZhYZHIDJ0JRAigJCbWHnpxAMNcuNmI=; b=pI5dMTnIj9+/rJIvF+QnXsK+wAjtZK0FwkVz4ggoRAZa6l7t+3uP6wHnK/u8RNvgfk +7wZTvXzQBOMgfgudTAZJ67m+TvZh1t1085DfVFacnuPUevRGbvjy+94jofLHz1KPvVr 9qBKbNxwNVBZAqaT5YpGkdQBVAZ/Xn4PScY8Vcg7SU1fO9zcQLWxoHC86qa4Wcz6r0U5 4rohbYBJLnnlgBTATI7L6ut9fAldmcsPneQoyV4HLMnQGgU+m7I2OkaZqfg65/CAMfFT rcccTT+fnOig8y7SKpYHor6s0zssM8vQny2cl2KKkyZKqUR7cRufcfu2LWRYeV3k4gxn 4PjQ== MIME-Version: 1.0 In-Reply-To: <50DF241B.5070007@davea.name> References: <50DF1D48.2060507@davea.name> <50DF241B.5070007@davea.name> Date: Sat, 29 Dec 2012 19:38:07 +0100 Subject: Re: Facing issue with Python loggin logger for printing object value From: Morten Engvoldsen To: d@davea.name Content-Type: multipart/alternative; boundary=14dae9340dd1c6fb0c04d2021485 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: 120 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1356806290 news.xs4all.nl 6933 [2001:888:2000:d::a6]:47755 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35762 --14dae9340dd1c6fb0c04d2021485 Content-Type: text/plain; charset=ISO-8859-1 Hi Dev, Thanks a lot Dev for your reply. It is really a great help. Yes i have fixed what was wrong in the create method like log.debug. I have declared line_counter=1 before the for loop. i will try now to chcek the value of payment_line. Thanks again a lot. I am greateful be a member of this forum :) On Sat, Dec 29, 2012 at 6:10 PM, Dave Angel wrote: > 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 > --14dae9340dd1c6fb0c04d2021485 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Dev,
Thanks a lot Dev for your reply. It is really a grea= t help. =A0Yes i have fixed what was wrong in the create method like log.de= bug. I have declared line_counter=3D1 before the for loop.=A0 i will try no= w to chcek the value of=A0 payment_line.
=A0
Thanks again a lot. I am greateful be a member of this f= orum :)

On Sat, Dec 29, 2012 at 6:= 10 PM, Dave Angel <d@davea.name> wrote:
On 12/29/2012 11:54 AM, Morten Engvoldse= n wrote:
> Hi Dave,
> Thanks a lot for your reply. I have used loggi= ng.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= . =A0If
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. =A0(Very bad practice)

It could be that payment_line is an empty list. =A0In that case, the loop will execute zero times. =A0That 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. =A0How 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? =A0Like using log.debug when the object was called logger? =A0Or incrementing
line_counter when there was no such variable, and when it would vanish
when you exited the method anyway?



--

DaveA

--14dae9340dd1c6fb0c04d2021485--