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


Groups > comp.lang.python > #35777

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

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!post.news.xs4all.nl!not-for-mail
Return-Path <mortenengv@gmail.com>
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; 'output': 0.04; 'subject:Python': 0.05; 'debugging': 0.05; 'none,': 0.05; 'dev': 0.07; 'variable,': 0.07; 'python': 0.09; '&quot;': 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; 'skip:+ 20': 0.18; 'email addr:gmail.com&gt;': 0.20; 'file.': 0.20; 'trying': 0.21; 'object.': 0.22; '\xa0if': 0.22; '\xa0so': 0.22; 'help.': 0.22; 'cc:2**0': 0.23; '&gt;': 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; 'list,': 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=TKBDJJNE2PiN9n/vE7eshUFE0KnexuK0c5uHXv7ORec=; b=Jx1j4yxBVInYZYf/kP2JsKBGmLxY/4qfB4UgIWiP30RsEANgzd891vCQoZD50E7cAh 3PVa3ud0TI4cWI8Yh62d/9wh6v8yi/nUqgEXNeukUJgOtxqwFmjAeVaz43wBiYpPdb9/ E9bsEIxjUAXDaYN9mZp+zuP4L7R5S1hRJrZ5asOn07wbWwN03HIylIgOC+WbycQLZOk2 xZX/ux9wEB77Wk4QQW22HizJKioYvWUFC3Pty/KRSB9GXDYX77iZmJZr+RFUlGNeFdnG T/PTf18IAwjFSLkufvWfk3Il3E/WNx95saoTe8CDhzEQfh9O6/n0VrGoKHtlSS6fp0a6 P0ag==
MIME-Version 1.0
In-Reply-To <CAJ2vgs7L5Ye2WsP55EzQQm4iHVNvPH6-dieJGSrHpjtaOThVog@mail.gmail.com>
References <CAJ2vgs6aDNFfrm+F7fRrBiE10naNQRKW_dwVGzM8BxCR9ws3Kw@mail.gmail.com> <50DF1D48.2060507@davea.name> <CAJ2vgs5j3+HYNWBd-3BN6p9hyDMG_5MmOrCKfodcMNzTg-OQUg@mail.gmail.com> <50DF241B.5070007@davea.name> <CAJ2vgs7L5Ye2WsP55EzQQm4iHVNvPH6-dieJGSrHpjtaOThVog@mail.gmail.com>
Date Sat, 29 Dec 2012 21:50:57 +0100
Subject Re: Facing issue with Python loggin logger for printing object value
From Morten Engvoldsen <mortenengv@gmail.com>
To d@davea.name
Content-Type multipart/alternative; boundary=14dae9340dd1dbf24704d203efa1
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 <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.1442.1356814265.29569.python-list@python.org> (permalink)
Lines 155
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1356814265 news.xs4all.nl 6840 [2001:888:2000:d::a6]:53222
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:35777

Show key headers only | View raw


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

Hi Dave,
It is able to log the message with:
logger.debug("value of payment_line is " +repr(payment_line))

The output is:
value of payment_line is []

So it means payment_line is an empty list, so may be it could be reason
it's not able to enter into the loop since the message in the for loop is
not logged in the log file.

Thanks and good night.. :)


On Sat, Dec 29, 2012 at 7:38 PM, Morten Engvoldsen <mortenengv@gmail.com>wrote:

> 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 <d@davea.name> 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
>>
>
>

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


Thread

Re: Facing issue with Python loggin logger for printing object value Morten Engvoldsen <mortenengv@gmail.com> - 2012-12-29 21:50 +0100
  Re: Facing issue with Python loggin logger for printing object value Roy Smith <roy@panix.com> - 2012-12-29 16:22 -0500

csiph-web