Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #44627
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <maitreymishra23@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'attribute': 0.07; 'error:': 0.07; 'work!': 0.07; 'tests,': 0.09; 'unittest': 0.09; 'used.': 0.09; 'python': 0.11; 'def': 0.12; 'wrote': 0.14; 'thread': 0.14; 'changes': 0.15; 'posted': 0.15; '"i': 0.16; 'ah,': 0.16; 'threads.': 0.16; 'subject:python': 0.16; 'prevent': 0.16; 'wrote:': 0.18; 'all,': 0.19; 'module': 0.19; 'trying': 0.19; 'file,': 0.19; 'server,': 0.19; 'thu,': 0.19; 'seems': 0.21; '8bit%:5': 0.22; '>>>': 0.22; 'example': 0.22; 'import': 0.22; 'email addr:gmail.com>': 0.22; 'otherwise,': 0.22; 'tests': 0.22; 'file.': 0.24; "i've": 0.25; '>': 0.26; 'class.': 0.26; 'logging': 0.26; 'task': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'to:2**1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'url:mailman': 0.30; 'code': 0.31; 'easier': 0.31; "skip:' 10": 0.31; 'that.': 0.31; '25,': 0.31; 'explained': 0.31; 'fine,': 0.31; 'file': 0.32; 'class': 0.32; 'thanks!': 0.32; 'skip:- 30': 0.32; 'url:python': 0.33; '-----': 0.33; 'fri,': 0.33; 'skip:_ 10': 0.34; 'problem': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; '2.6': 0.36; 'module.': 0.36; 'done': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'responsible': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'should': 0.36; 'implement': 0.38; 'server': 0.38; 'skip:& 10': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'skip:& 20': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'applicable': 0.60; 'skip:y 20': 0.60; 'most': 0.60; 'skip:t 30': 0.61; 'url:3': 0.61; 'you.': 0.62; 'information': 0.63; 'url:blogspot': 0.65; 'here': 0.66; 'notice:': 0.67; '26,': 0.68; 'person,': 0.68; 'privileged.': 0.69; 'disclose': 0.74; '2.5.': 0.84; 'br,': 0.84; 'missing.': 0.84; '"how': 0.91; 'medium.': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=i/+5inSg47KqRE9nZ7sMa28jhm+hx/W76B+PP0xe6tE=; b=u+jN4KsNHbwGBH/VKoLViDpReatlFyMX+kObMZ5/Adc/2cVzsmMNAh3TDehygfDhBO BDQDhugwXp/3Ee/ReFK43HX9sopj4SzTvyuQDB9KmUsmWsZbbLWU/7+pGGUgQeIwX46O GC4EldxqMBzZLUOHAEExBt+bH20REf4eExkZXRUDMRCEmCLeBUJrn9aIbzcHq6q5g8tq RTqwlwKaVXjC8LvaKvKe8XexXWOhg1Qfv7vfAaPS3QMqreeAOAgGQDy+F4RaK+fNuFge mpTrzuntiheJiv11TrLkaYqo+FW0aZ5CdsuRT7aBcYcsR7lyKUEqWaMpZUOrmW1E3c7f m0aw== |
| MIME-Version | 1.0 |
| X-Received | by 10.152.120.40 with SMTP id kz8mr2574572lab.32.1367504028493; Thu, 02 May 2013 07:13:48 -0700 (PDT) |
| In-Reply-To | <229947553.5215691.1366982379397.JavaMail.root@sequans.com> |
| References | <CAO=YJ3d3qUAnnfA5vRJORJ3VGSzaEAskAR7Tgi_JZKtsefBkKA@mail.gmail.com> <229947553.5215691.1366982379397.JavaMail.root@sequans.com> |
| Date | Thu, 2 May 2013 16:13:48 +0200 |
| Subject | Re: Efficient way of looging in python |
| From | Maitrey Mishra <maitreymishra23@gmail.com> |
| To | Jean-Michel Pichavant <jeanmichel@sequans.com>, python-list@python.org |
| Content-Type | multipart/alternative; boundary=089e012281b4d8ec8404dbbcd777 |
| 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.1239.1367504036.3114.python-list@python.org> (permalink) |
| Lines | 251 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1367504036 news.xs4all.nl 16001 [2001:888:2000:d::a6]:47145 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:44627 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
I wrote some tests for logging module. I use python 2.6 and use the example
as in cookbook
file : Test_Task.py
from threading import Thread
import Logging.logQueueHandler as logq
class TestTask(threading.Thread):
def __init__(self):
pass
def run(self):
t = Thread(target=logq.log, args=("ERROR", "Hi"))
t.start()
q = Thread(target=logq.log, args=("ERROR", "Hello"))
q.start()
p = Thread(target=logq.log, args=("ERROR", "How are you?"))
p.start()
l = Thread(target=logq.log, args=("ERROR", "I am fine, Thank You!"))
l.start()
call_test.py
from Test_Task import TestTask
import unittest
task = TestTask()
task.run()
However, In the log messages I see a number of messages missing.
With the tests, my aim is to see how logging works with multiple threads.
On Fri, Apr 26, 2013 at 3:19 PM, Jean-Michel Pichavant <
jeanmichel@sequans.com> wrote:
> Yep that's the one I used.
>
> ------------------------------
>
> Ah,
> http://plumberjack.blogspot.de/2010/09/using-logging-with-multiprocessing.html
> I use this now, it seems to work!
> Thanks!
>
>
> On Fri, Apr 26, 2013 at 2:16 PM, Maitrey Mishra <maitreymishra23@gmail.com
> > wrote:
>
>> Hi All,
>> Thanks for the inputs.
>> I use python2.6. It seems to be easier with python3.2 and QueueHandler
>> class.
>> I pasted the class in my code however I still get the
>> error: AttributeError: 'module' object has no attribute 'QueueHandler'
>> What changes did you do for adapting to python2.5?
>>
>> Thanks!
>> Br,
>> Maitrey
>>
>>
>>
>> On Thu, Apr 25, 2013 at 4:32 PM, Jean-Michel Pichavant <
>> jeanmichel@sequans.com> wrote:
>>
>>> ----- Original Message -----
>>> > Hi,
>>> >
>>> > I need an efficient way of logging using python.
>>> > My problem statemnt:
>>> > 1. I have multiple processes using the same logging file.
>>> > I need solutions to the following:
>>> > a) If multiple processes are trying to write to the same file, I need
>>> > to prevent that. Otherwise, the logging messages will be puzzling to
>>> > the user as he would see logging messages from one module than may
>>> > be some other following it.
>>> >
>>> > Please let me know if there is an efficient way to do it.
>>> >
>>> > Thanks!
>>> >
>>> > Br,
>>> > Maitrey
>>> > --
>>> > http://mail.python.org/mailman/listinfo/python-list
>>>
>>> Everything you need should be explained here
>>>
>>> http://docs.python.org/release/3.2/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes
>>>
>>> Most of the concepts are applicable to any version of python I've done
>>> it with python 2.5. I used some Vinay's code posted on the net to implement
>>> a logging server, all my processes are logging to that server which is
>>> responsible for writing the file.
>>>
>>> JM
>>>
>>>
>>> -- IMPORTANT NOTICE:
>>>
>>> The contents of this email and any attachments are confidential and may
>>> also be privileged. If you are not the intended recipient, please notify
>>> the sender immediately and do not disclose the contents to any other
>>> person, use it for any purpose, or store or copy the information in any
>>> medium. Thank you.
>>>
>>
>>
>
>
>
> -- IMPORTANT NOTICE:
>
> The contents of this email and any attachments are confidential and may
> also be privileged. If you are not the intended recipient, please notify
> the sender immediately and do not disclose the contents to any other
> person, use it for any purpose, or store or copy the information in any
> medium. Thank you.
>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Efficient way of looging in python Maitrey Mishra <maitreymishra23@gmail.com> - 2013-05-02 16:13 +0200
csiph-web