Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Write by logging.FileHandler to one file by many processess

Reply
Thread Tools

Write by logging.FileHandler to one file by many processess

 
 
=?UTF-8?B?UmFmYcWC?= Zawadzki
Guest
Posts: n/a
 
      10-17-2007
Hello.

As I saw in logging source - there is no lock per file during making emit()
(only lock per thread).

So, my question is - is it safe to log into one file using many processess
uses logging logger?

Cheers,
--
bluszcz
http://vegan-planet.net
 
Reply With Quote
 
 
 
 
Alexandre Badez
Guest
Posts: n/a
 
      10-17-2007
On Oct 17, 3:33 pm, Rafa Zawadzki <(E-Mail Removed)> wrote:
> Hello.
>
> As I saw in logging source - there is no lock per file during making emit()
> (only lock per thread).
>
> So, my question is - is it safe to log into one file using many processess
> uses logging logger?
>
> Cheers,
> --
> bluszczhttp://vegan-planet.net


Well, there a dummy response: there is no true thread in Python (I
mean CPython). So there is no problems in this case (cf global
interpreter lock or GIL).

 
Reply With Quote
 
 
 
 
Diez B. Roggisch
Guest
Posts: n/a
 
      10-17-2007
Alexandre Badez wrote:

> On Oct 17, 3:33 pm, Rafa Zawadzki <(E-Mail Removed)> wrote:
>> Hello.
>>
>> As I saw in logging source - there is no lock per file during making
>> emit() (only lock per thread).
>>
>> So, my question is - is it safe to log into one file using many
>> processess uses logging logger?
>>
>> Cheers,
>> --
>> bluszczhttp://vegan-planet.net

>
> Well, there a dummy response: there is no true thread in Python (I
> mean CPython). So there is no problems in this case (cf global
> interpreter lock or GIL).


You didn't read the statement of the OP - he explicitly doesn't ask about
threads, but multiple processes writing to one file.

I presume things get messed up... but I don't know for sure.

Diez
 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      10-18-2007
En Wed, 17 Oct 2007 11:10:55 -0300, Diez B. Roggisch <(E-Mail Removed)>
escribió:

>> On Oct 17, 3:33 pm, Rafa Zawadzki <(E-Mail Removed)> wrote:
>>>
>>> As I saw in logging source - there is no lock per file during making
>>> emit() (only lock per thread).
>>>
>>> So, my question is - is it safe to log into one file using many
>>> processess uses logging logger?

>
> I presume things get messed up... but I don't know for sure.


Yes, output from several processes comes horribly mixed...
I've avoided it using separate log files for each process; but if that's
not possible, one could try using syslog or a SocketHandler and a separate
listening process.

--
Gabriel Genellina

 
Reply With Quote
 
Vinay Sajip
Guest
Posts: n/a
 
      10-23-2007
On Oct 18, 4:08 am, "Gabriel Genellina" <(E-Mail Removed)>
wrote:
> Yes, output from several processes comes horribly mixed...
> I've avoided it using separate log files for each process; but if that's
> not possible, one could try using syslog or a SocketHandler and a separate
> listening process.


The Python logging docs even contain a working example of such a
listening process (receiver):

http://www.python.org/doc/current/li...k-logging.html

Regards,

Vinay Sajip

 
Reply With Quote
 
Gabriel Genellina
Guest
Posts: n/a
 
      10-23-2007
En Tue, 23 Oct 2007 05:08:11 -0300, Vinay Sajip <(E-Mail Removed)>
escribi�:

> On Oct 18, 4:08 am, "Gabriel Genellina" <(E-Mail Removed)>
> wrote:
>> Yes, output from several processes comes horribly mixed...
>> I've avoided it using separate log files for each process; but if that's
>> not possible, one could try using syslog or a SocketHandler and a
>> separate
>> listening process.

>
> The Python logging docs even contain a working example of such a
> listening process (receiver):
>
> http://www.python.org/doc/current/li...k-logging.html


Great!

--
Gabriel Genellina

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
migrating processess to avoid the GIL Patrick Stinson Python 1 09-20-2008 05:03 AM
testing a code that runs in multiple processess and communicates via network raven Java 1 04-25-2007 11:51 AM
many aspnet applications in one site? many Gloabal.asax files ok? dee ASP .Net 2 08-15-2005 03:07 AM
Embedding: many interpreters OR one interpreter with many thread states ? adsheehan@eircom.net Python 3 06-10-2005 03:18 AM
Many-to-Many :: seperate database or one database? jason ASP General 6 08-12-2003 09:31 AM



Advertisments