Sometimes, I notice the below errors:
 python call_Test.py
Traceback (most recent call last):
  File "call_Test.py", line 1, in <module>
    from Test_Task import TestTask
  File
"/cygdrive/d/smoketest/targetflasher/flasher_server/Source/Test_Task.py",
line 5, in <module>
    import Logging.logQueueHandler as logq
  File
"/cygdrive/d/smoketest/targetflasher/flasher_server/Source/Logging/logQueueHandler.py",
line 72, in <module>
    queue = multiprocessing.Queue(-1)
  File "/usr/lib/python2.6/multiprocessing/__init__.py", line 213, in Queue
    return Queue(maxsize)
  File "/usr/lib/python2.6/multiprocessing/queues.py", line 37, in __init__
    self._rlock = Lock()
  File "/usr/lib/python2.6/multiprocessing/synchronize.py", line 117, in
__init__
    SemLock.__init__(self, SEMAPHORE, 1, 1)
  File "/usr/lib/python2.6/multiprocessing/synchronize.py", line 49, in
__init__
    sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 17] File exists



On Thu, May 2, 2013 at 4:13 PM, Maitrey Mishra <maitreymishr...@gmail.com>wrote:

> 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 <
> jeanmic...@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 <
>> maitreymishr...@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 <
>>> jeanmic...@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.
>>
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to