Hello,
I'm getting strange exception raised using module logging.
It's strange because it happens only sometimes, and it happens
in different places (but always in a logging method).
i.e. this line of code:
log.info('SMS sent')
produces following traceback:
Traceback (most recent call last):
File "L:\_progs\pyth on\test\send_sm s.py", line 36, in send_sms
log.info('SMS sent')
File "L:\Python23\li b\logging\__ini t__.py", line 893, in info
apply(self._log , (INFO, msg, args), kwargs)
File "L:\Python23\li b\logging\__ini t__.py", line 994, in _log
self.handle(rec ord)
File "L:\Python23\li b\logging\__ini t__.py", line 1004, in handle
self.callHandle rs(record)
File "L:\Python23\li b\logging\__ini t__.py", line 1037, in callHandlers
hdlr.handle(rec ord)
File "L:\Python23\li b\logging\__ini t__.py", line 592, in handle
self.emit(recor d)
File "L:\Python23\li b\logging\__ini t__.py", line 684, in emit
self.handleErro r(record)
File "L:\Python23\li b\logging\__ini t__.py", line 636, in handleError
traceback.print _exception(ei[0], ei[1], ei[2], None, sys.stderr)
File "L:\Python23\li b\traceback.py" , line 123, in print_exception
print_tb(tb, limit, file)
File "L:\Python23\li b\traceback.py" , line 69, in print_tb
if line: _print(file, ' ' + line.strip())
File "L:\Python23\li b\traceback.py" , line 13, in _print
file.write(str+ terminator)
IOError: [Errno 9] Bad file descriptor
This is the way I initialize logging:
def initLogger(file name):
log = logging.getLogg er('test')
formatter = logging.Formatt er('%(asctime)s %(name)s %(levelname)s %(message)s')
# file
hdlr = logging.FileHan dler(filename)
hdlr.setFormatt er(formatter)
log.addHandler( hdlr)
# screen
hdlr = logging.StreamH andler(sys.stdo ut)
hdlr.setFormatt er(formatter)
log.addHandler( hdlr)
log.setLevel(lo gging.DEBUG)
return log
log = initLogger('tes t.log')
I pass variable "log" to functions requesting it.
My script runs continually, sleeping 1h, doing something, sleeping 1h, etc.
Is it possible that file handler expires or something?
Do I do something wrong?
Thanks,
Marek Augustyn 0 1316 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Sean Ross |
last post by:
Here's a breakdown of most of the syntax discussed re: PEP318 using an
example from python-dev. There are probably several more (I've added ).
The example applies both function decoration and annotation.
# .. , competing ways to say the same thing
#
def foo(self) :
"doc string"
|
by: jjesso |
last post by:
I am trying to add a new logging level.
logging.config.fileConfig("bengineLog.cfg")
logging.CLIENT = logging.INFO + 1
logging.addLevelName( logging.CLIENT, 'CLIENT' )
logging.root.setLevel( )
logger = logging.getLogger(None)
logging.Logger.client('test')
I get error:
|
by: Karuppasamy |
last post by:
H
I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net
I installed everything as per the Instructions given in the 'Development Using the Logging Block'
But when i am trying to run the sample, i am getting the following error in the Event Viwer
Kindly help me on this
|
by: pmatos |
last post by:
Hi all,
I am trying to create a simple but efficient C++ logging class. I know
there are lots of them out there but I want something simple and
efficient. The number one requirement is the possibility of shutting
logging down at compile time and suffer no performance penalty
whatsoever for getting logging on whenever I wish. Of course that I
would need to recompile the project each time I want to turn logging on
or off. But given a...
|
by: BuddyWork |
last post by:
Hello,
I want to know if there any good tools out there which
will show me a breakdown of the memory allocation in Gen
2 heap, basically a breakdown by object is what I'm
looking for.
The reason for this is that I eventually get the
OutOfMemory exception. I can see the GEN2, GEN1, GEN0 GC
kicking in but when run a pariticular code approx 2333
| |
by: Atley |
last post by:
I am trying to get a overall difference on two dates,
I can get the difference in Years, Months, Weeks, Days, Hours, Minutes,
Seconds, no problems...
What I cannot seem to figure out is how to get:
2 Years, 3 Months, 1 Week, 3 Days, 14 Hours, 21 Minutes, 33 Seconds.
The hardest part of that, the part I cannot figure out, is the Month
|
by: robert |
last post by:
As more and more python packages are starting to use the bloomy
(Java-ish) 'logging' module in a mood of responsibility and as I am not
overly happy with the current "thickener" style of usage, I want to put
this comment and a alternative most simple default framework for
discussion.
Maybe there are more Python users which like to see that imported
(managed) logging issue more down-to-earth and flexible ? ...
Vinay Sajip wrote:
>...
|
by: Daron |
last post by:
Is it possible to use SQL to take a field, and break it down by
denominations?
I would like to take a field, and then break this out into the number
of bills($100's, $50's, etc) I would need:
$469.32 =
4x$100
1x$50
1x$10
1x$5
|
by: Benny |
last post by:
I might be overcomplicating the solution, but the problem is I have to
make a breakdown of each week for many ranges of dates within a
particular year. So for example one record might have a start date of
1/1/2008 and an end date of 2/31/2008 and I need to break down each
week within that period and display the data corresponding to that
range. Here is an example of the data and how it should look.
StartDate EndDate ...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |