473,804 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

loggin

hi!

in my web app. i log debug messages to a file. however, sometimes the
messages appear more than once even though the code in which the log
statement appears gets executes only once
i have a utilities.py file which defines a getLogger() method as follows

logger = logging.getLogg er('../logs/umapp')
hdlr = logging.FileHan dler('../logs/umapp.log')
os.system("chmo d 755 ../logs/umapp.log")
formatter = logging.Formatt er('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatt er(formatter)
logger.addHandl er(hdlr)
logger.setLevel (logging.INFO)
return logger

all my cgi scripts the the start make the call - logger =
utilities.getLo gger()

the scripts then log debug messages during different stages of their
execution.

however, some of these debug messages appear 2 or 3 times on the log file.
i have verified that the particular code block in which the log statement
is present is executed only once

any ideas

thanks
cheers

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
Jul 18 '05 #1
1 1670
Ajay <ab******@mail. usyd.edu.au> wrote in message news:<ma******* *************** *************** *@python.org>.. .
hi!

in my web app. i log debug messages to a file. however, sometimes the
messages appear more than once even though the code in which the log
statement appears gets executes only once
i have a utilities.py file which defines a getLogger() method as follows

logger = logging.getLogg er('../logs/umapp')
hdlr = logging.FileHan dler('../logs/umapp.log')
os.system("chmo d 755 ../logs/umapp.log")
formatter = logging.Formatt er('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatt er(formatter)
logger.addHandl er(hdlr)
logger.setLevel (logging.INFO)
return logger

all my cgi scripts the the start make the call - logger =
utilities.getLo gger()

the scripts then log debug messages during different stages of their
execution.

however, some of these debug messages appear 2 or 3 times on the log file.
i have verified that the particular code block in which the log statement
is present is executed only once

any ideas


Make sure you don't add the same handler several times to a given
logger or to the root. If you do this, the logging messages get
handled (=> displayed) multiple times.

Regards

Vinay Sajip
Jul 18 '05 #2

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

Similar topics

0
1207
by: flamesrock | last post by:
First, my problem doesn't make much practical sense so I hope you're up for a challenge. What I have (in concept) is a standalone web client that connects different 'players' to a central host and distributes game files between them. A user claims certain files, plays them, and then automatically uploads them to the site where they are subsequently distributed. What I want to do is have a secure system that lets users log in upon
0
1314
by: Stan | last post by:
I will need to implement a site wide logging component for an Asset Tracking and Management System and I am wondering if the MSWC.IISLog component with IIS is up to the job and is customisable for custom use or should i invest time in creating my own. Logging needs include exceptions, failures, use tracking, logging-in information, session stats etc on approx 150 pages for approx 25 users..
1
1974
by: David | last post by:
Dear All, I wanna display text after typing "conn / as ..." in sqlplus . How can I do that ? I think I have to create a trigger on that. However, I havent any idea how to construct it. Thanks a lot. Best Regards, David
6
1579
by: Richard Silverstein | last post by:
I'm a member of a forum sponsored by jasc.com ( http://forums.jasc.com/ ) which uses Webboard software. I use Firefox 1.0 (final release) as my browser. When I used previous versions of FF I had no problem logging into the forum. But with v. 1.0 I'm getting a javascript error saying "You could not be logged in." When I login from IE I don't have this problem. I've posted in this forum & the Firefox forum asking whether others have...
1
1732
by: Thomas LeBlanc | last post by:
Are there settings in PostgreSQL to log SQL Statements from client apps? Is yes, where are they logged to? We set log_statement=On, but where does the log get sritten to? Thanks, Thomas LeBlanc _________________________________________________________________
3
1501
by: clécio | last post by:
hi folks! How can i log all request in my web application? But i wanted something that not consume the time of the request (using treads, for ex)! I tried to use the ASYNCBEGINREQUEST , but it doesn´t work! Any example will be welcome! tks
2
985
by: Lee | last post by:
Hello all, I have a question about logging in users. Let's say that my website sends an email to a person with a link to go directly to a particular part of the site. The user must be logged in, in order to go to that particular portion of the site. What is the common methodology for having them "pitstop" to the login page before continuing to the linked page?
5
2179
by: paitoon | last post by:
Well, actually im bad in this im not sure if i post the title correctly... My problem is I make a site which people can comment the picture each other.. every comment will be sent to their email to lead them to see that comments page......but they have to login first...... My problem is howto do that ? for example i set like this u have got a comment on your pic if u want to see it just loggin www.mysite.com/see_img.php?id=10278
1
1322
by: pankajprakash | last post by:
Hi, I have used Application Loggin Enterprise Library in a web application to write the event information in a file. The file is exist in the other location, and the web application does have have any writes to write in the file. Would you please let me know how I can pass the credential with the Application Logging Enterprise Library.
0
9705
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
10323
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
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
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
5516
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
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
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
3
2988
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.