473,799 Members | 3,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Write by logging.FileHan dler to one file by many processess

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
Oct 17 '07 #1
5 2677
On Oct 17, 3:33 pm, Rafa Zawadzki <blus...@jabber pl.orgwrote:
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).

Oct 17 '07 #2
Alexandre Badez wrote:
On Oct 17, 3:33 pm, Rafa Zawadzki <blus...@jabber pl.orgwrote:
>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
Oct 17 '07 #3
En Wed, 17 Oct 2007 11:10:55 -0300, Diez B. Roggisch <de***@nospam.w eb.de>
escribió:
>On Oct 17, 3:33 pm, Rafa Zawadzki <blus...@jabber pl.orgwrote:
>>>
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

Oct 18 '07 #4
On Oct 18, 4:08 am, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
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

Oct 23 '07 #5
En Tue, 23 Oct 2007 05:08:11 -0300, Vinay Sajip <vi*********@ya hoo.co.uk>
escribi�:
On Oct 18, 4:08 am, "Gabriel Genellina" <gagsl-...@yahoo.com.a r>
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

Oct 23 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1423
by: max | last post by:
I have an application which calls a module runx, in runx I import logging and get a logger add handlers. I want to be able to rename the file created by fileHandler. several problems, I can't seem to be able to rename the file, calling shutdown, or removeHandler and then hndlr.close(), I get No handlers could be found for logger "root" even though I am not calling any related methods. The second problem I find if I re-enter my module...
8
2005
by: Steve Erickson | last post by:
I have a logger class that uses the Python logging module. When I call it within a program using the unittest module, I get one line in the log file for the first test, two identical ones for the second, etc. I'm using local variables, which should go out of context with each test. Setting the 'propagate' property to False doesn't have any affect. import logging, os, signal, sys from datetime import datetime
6
10887
by: Ville Vainio | last post by:
Just posting this for the sake of google: Like everyone else, I figured it's time to start using the 'logging' module. I typically want to dump "info" level (and up) log information to screen, and "debug" level (and up) to a log file for in-depth analysis. This is for scripts, so date/time/severity information is not wanted. I assumed such a simple use case would have an example in the docs (py 2.4), but no luck.
7
2431
by: Jed Parsons | last post by:
Hi, I'm using the logging module for the first time. I'm using it from within Zope Extensions. My problem is that, for every event logged, the logger is producing multiple identical entries with the timestamp the same down to the millisecond. Is this something I'm doing wrong?
1
3553
by: fuzzylollipop | last post by:
I want a FileHandler to only log a single level say for example logging.INFO, and nothing else. do I need to create a custom Handler for this or is this doable with some magic that is not documeneted somewhere?
3
7192
by: pundarikakshaiah | last post by:
Hi, I am using JDK1.4 logging framework and below are the properties that I have in my logging.properties file to configure logging.. handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandler .level= INFO java.util.logging.ConsoleHandler.level=SEVERE java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter java.util.logging.FileHandler.level=INFO java.util.logging.FileHandler.pattern=%h/java%u.log...
1
3651
by: Kenneth Love | last post by:
I have a Python logging config file that contains a RotatingFileHandler handler. In the args key, I have hard-coded the log filename. Everything works great. However, I find that I now need to override this filename at application runtime. Is there a good way to do this? Here is a bit of sample code that (hopefully) clarifies my question. --------------- log.ini -----------------
6
5691
by: Vyacheslav Maslov | last post by:
Hi all! I have many many many python unit test, which are used for testing some remote web service. The most important issue here is logging of test execution process and result. I strongly need following: 1. start/end timestamp for each test case (most important) 2. immediate report about exceptions (stacktrace) 3. it will be nice to use logging module for output
3
2227
by: guybenron | last post by:
Hey, I have a sort of petty-neurotic question, I'm kinda pedantic and like to keep my log directories clean, and this thing is bothering me to the point of actually posting a question (couldn't find any post about this..). My application has two types of components: daemons and regular ones that are run every on crontab. Because the log structure is very similar, I want both to use the same logging configuration file.
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.