473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.getLogger('../logs/umapp')
hdlr = logging.FileHandler('../logs/umapp.log')
os.system("chmod 755 ../logs/umapp.log")
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
return logger

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

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 1649
Ajay <ab******@mail.usyd.edu.au> wrote in message news:<ma**************************************@pyt hon.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.getLogger('../logs/umapp')
hdlr = logging.FileHandler('../logs/umapp.log')
os.system("chmod 755 ../logs/umapp.log")
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel(logging.INFO)
return logger

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

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
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...
0
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...
1
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...
6
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...
1
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...
3
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...
2
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...
5
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...
1
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.