2007-08-15 11:28:22 -03:00
|
|
|
:mod:`logging` --- Logging facility for Python
|
|
|
|
==============================================
|
|
|
|
|
|
|
|
.. module:: logging
|
|
|
|
:synopsis: Flexible error logging system for applications.
|
|
|
|
|
|
|
|
|
|
|
|
.. moduleauthor:: Vinay Sajip <vinay_sajip@red-dove.com>
|
|
|
|
.. sectionauthor:: Vinay Sajip <vinay_sajip@red-dove.com>
|
|
|
|
|
|
|
|
|
|
|
|
.. index:: pair: Errors; logging
|
|
|
|
|
|
|
|
This module defines functions and classes which implement a flexible error
|
|
|
|
logging system for applications.
|
|
|
|
|
|
|
|
Logging is performed by calling methods on instances of the :class:`Logger`
|
|
|
|
class (hereafter called :dfn:`loggers`). Each instance has a name, and they are
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
conceptually arranged in a namespace hierarchy using dots (periods) as
|
2007-08-15 11:28:22 -03:00
|
|
|
separators. For example, a logger named "scan" is the parent of loggers
|
|
|
|
"scan.text", "scan.html" and "scan.pdf". Logger names can be anything you want,
|
|
|
|
and indicate the area of an application in which a logged message originates.
|
|
|
|
|
|
|
|
Logged messages also have levels of importance associated with them. The default
|
|
|
|
levels provided are :const:`DEBUG`, :const:`INFO`, :const:`WARNING`,
|
|
|
|
:const:`ERROR` and :const:`CRITICAL`. As a convenience, you indicate the
|
|
|
|
importance of a logged message by calling an appropriate method of
|
|
|
|
:class:`Logger`. The methods are :meth:`debug`, :meth:`info`, :meth:`warning`,
|
|
|
|
:meth:`error` and :meth:`critical`, which mirror the default levels. You are not
|
|
|
|
constrained to use these levels: you can specify your own and use a more general
|
|
|
|
:class:`Logger` method, :meth:`log`, which takes an explicit level argument.
|
|
|
|
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
Logging tutorial
|
|
|
|
----------------
|
|
|
|
|
|
|
|
The key benefit of having the logging API provided by a standard library module
|
|
|
|
is that all Python modules can participate in logging, so your application log
|
|
|
|
can include messages from third-party modules.
|
|
|
|
|
|
|
|
It is, of course, possible to log messages with different verbosity levels or to
|
|
|
|
different destinations. Support for writing log messages to files, HTTP
|
|
|
|
GET/POST locations, email via SMTP, generic sockets, or OS-specific logging
|
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60901 | eric.smith | 2008-02-19 14:21:56 +0100 (Tue, 19 Feb 2008) | 1 line
Added PEP 3101.
........
r60907 | georg.brandl | 2008-02-20 20:12:36 +0100 (Wed, 20 Feb 2008) | 2 lines
Fixes contributed by Ori Avtalion.
........
r60909 | eric.smith | 2008-02-21 00:34:22 +0100 (Thu, 21 Feb 2008) | 1 line
Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description).
........
r60910 | eric.smith | 2008-02-21 00:39:28 +0100 (Thu, 21 Feb 2008) | 1 line
Now that PyOS_ascii_formatd supports the 'n' format, simplify the float formatting code to just call it.
........
r60918 | andrew.kuchling | 2008-02-21 15:23:38 +0100 (Thu, 21 Feb 2008) | 2 lines
Close manifest file.
This change doesn't make any difference to CPython, but is a necessary fix for Jython.
........
r60921 | guido.van.rossum | 2008-02-21 18:46:16 +0100 (Thu, 21 Feb 2008) | 2 lines
Remove news about float repr() -- issue 1580 is still in limbo.
........
r60923 | guido.van.rossum | 2008-02-21 19:18:37 +0100 (Thu, 21 Feb 2008) | 5 lines
Removed uses of dict.has_key() from distutils, and uses of
callable() from copy_reg.py, so the interpreter now starts up
without warnings when '-3' is given. More work like this needs to
be done in the rest of the stdlib.
........
r60924 | thomas.heller | 2008-02-21 19:28:48 +0100 (Thu, 21 Feb 2008) | 4 lines
configure.ac: Remove the configure check for _Bool, it is already done in the
top-level Python configure script.
configure, fficonfig.h.in: regenerated.
........
r60925 | thomas.heller | 2008-02-21 19:52:20 +0100 (Thu, 21 Feb 2008) | 3 lines
Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
........
r60927 | raymond.hettinger | 2008-02-21 20:24:53 +0100 (Thu, 21 Feb 2008) | 1 line
Update more instances of has_key().
........
r60928 | guido.van.rossum | 2008-02-21 20:46:35 +0100 (Thu, 21 Feb 2008) | 3 lines
Fix a few typos and layout glitches (more work is needed).
Move 2.5 news to Misc/HISTORY.
........
r60936 | georg.brandl | 2008-02-21 21:33:38 +0100 (Thu, 21 Feb 2008) | 2 lines
#2079: typo in userdict docs.
........
r60938 | georg.brandl | 2008-02-21 21:38:13 +0100 (Thu, 21 Feb 2008) | 2 lines
Part of #2154: minimal syntax fixes in doc example snippets.
........
r60942 | raymond.hettinger | 2008-02-22 04:16:42 +0100 (Fri, 22 Feb 2008) | 1 line
First draft for itertools.product(). Docs and other updates forthcoming.
........
r60955 | nick.coghlan | 2008-02-22 11:54:06 +0100 (Fri, 22 Feb 2008) | 1 line
Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery)
........
r60956 | georg.brandl | 2008-02-22 13:31:45 +0100 (Fri, 22 Feb 2008) | 2 lines
A lot more typo fixes by Ori Avtalion.
........
r60957 | georg.brandl | 2008-02-22 13:56:34 +0100 (Fri, 22 Feb 2008) | 2 lines
Don't reference pyshell.
........
r60958 | georg.brandl | 2008-02-22 13:57:05 +0100 (Fri, 22 Feb 2008) | 2 lines
Another fix.
........
2008-02-22 12:37:40 -04:00
|
|
|
mechanisms are all supported by the standard module. You can also create your
|
2007-12-04 15:30:01 -04:00
|
|
|
own log destination class if you have special requirements not met by any of the
|
|
|
|
built-in classes.
|
|
|
|
|
|
|
|
Simple examples
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
.. sectionauthor:: Doug Hellmann
|
|
|
|
.. (see <http://blog.doughellmann.com/2007/05/pymotw-logging.html>)
|
|
|
|
|
|
|
|
Most applications are probably going to want to log to a file, so let's start
|
|
|
|
with that case. Using the :func:`basicConfig` function, we can set up the
|
|
|
|
default handler so that debug messages are written to a file::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
LOG_FILENAME = '/tmp/logging_example.out'
|
Merged revisions 74779-74786,74793,74795,74811,74860-74861,74863,74876,74886,74896,74901,74903,74908,74912,74930,74933,74943,74946,74952-74955,75015,75019,75032,75068,75076,75095,75098,75102,75129,75139,75230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74779 | michael.foord | 2009-09-13 11:13:36 -0500 (Sun, 13 Sep 2009) | 1 line
Change to tutorial wording for reading text / binary files on Windows. Issue #6301.
........
r74780 | michael.foord | 2009-09-13 11:40:02 -0500 (Sun, 13 Sep 2009) | 1 line
Objects that compare equal automatically pass or fail assertAlmostEqual and assertNotAlmostEqual tests on unittest.TestCase. Issue 6567.
........
r74781 | michael.foord | 2009-09-13 11:46:19 -0500 (Sun, 13 Sep 2009) | 1 line
Note that sys._getframe is not guaranteed to exist in all implementations of Python, and a corresponding note in inspect.currentframe. Issue 6712.
........
r74782 | michael.foord | 2009-09-13 12:07:46 -0500 (Sun, 13 Sep 2009) | 1 line
Tutorial tweaks. Issue 6849.
........
r74783 | michael.foord | 2009-09-13 12:28:35 -0500 (Sun, 13 Sep 2009) | 1 line
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
........
r74784 | georg.brandl | 2009-09-13 13:15:07 -0500 (Sun, 13 Sep 2009) | 1 line
Typo fix.
........
r74785 | michael.foord | 2009-09-13 14:07:03 -0500 (Sun, 13 Sep 2009) | 1 line
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
........
r74786 | michael.foord | 2009-09-13 14:08:18 -0500 (Sun, 13 Sep 2009) | 1 line
Remove an extraneous space in unittest documentation.
........
r74793 | georg.brandl | 2009-09-14 09:50:47 -0500 (Mon, 14 Sep 2009) | 1 line
#6908: fix association of hashlib hash attributes.
........
r74795 | benjamin.peterson | 2009-09-14 22:36:26 -0500 (Mon, 14 Sep 2009) | 1 line
Py_SetPythonHome uses static storage #6913
........
r74811 | georg.brandl | 2009-09-15 15:26:59 -0500 (Tue, 15 Sep 2009) | 1 line
Add Armin Ronacher.
........
r74860 | benjamin.peterson | 2009-09-16 21:46:54 -0500 (Wed, 16 Sep 2009) | 1 line
kill bare except
........
r74861 | benjamin.peterson | 2009-09-16 22:18:28 -0500 (Wed, 16 Sep 2009) | 1 line
pep 8 defaults
........
r74863 | benjamin.peterson | 2009-09-16 22:27:33 -0500 (Wed, 16 Sep 2009) | 1 line
rationalize a bit
........
r74876 | georg.brandl | 2009-09-17 11:15:53 -0500 (Thu, 17 Sep 2009) | 1 line
#6932: remove paragraph that advises relying on __del__ being called.
........
r74886 | benjamin.peterson | 2009-09-17 16:33:46 -0500 (Thu, 17 Sep 2009) | 1 line
use macros
........
r74896 | georg.brandl | 2009-09-18 02:22:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6936: for interactive use, quit() is just fine.
........
r74901 | georg.brandl | 2009-09-18 04:14:52 -0500 (Fri, 18 Sep 2009) | 1 line
#6905: use better exception messages in inspect when the argument is of the wrong type.
........
r74903 | georg.brandl | 2009-09-18 04:18:27 -0500 (Fri, 18 Sep 2009) | 1 line
#6938: "ident" is always a string, so use a format code which works.
........
r74908 | georg.brandl | 2009-09-18 08:57:11 -0500 (Fri, 18 Sep 2009) | 1 line
Use str.format() to fix beginner's mistake with %-style string formatting.
........
r74912 | georg.brandl | 2009-09-18 11:19:56 -0500 (Fri, 18 Sep 2009) | 1 line
Optimize optimization and fix method name in docstring.
........
r74930 | georg.brandl | 2009-09-18 16:21:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6925: rewrite docs for locals() and vars() a bit.
........
r74933 | georg.brandl | 2009-09-18 16:35:59 -0500 (Fri, 18 Sep 2009) | 1 line
#6930: clarify description about byteorder handling in UTF decoder routines.
........
r74943 | georg.brandl | 2009-09-19 02:35:07 -0500 (Sat, 19 Sep 2009) | 1 line
#6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple.
........
r74946 | georg.brandl | 2009-09-19 03:43:16 -0500 (Sat, 19 Sep 2009) | 1 line
Update bug tracker reference.
........
r74952 | georg.brandl | 2009-09-19 05:42:34 -0500 (Sat, 19 Sep 2009) | 1 line
#6946: fix duplicate index entries for datetime classes.
........
r74953 | georg.brandl | 2009-09-19 07:04:16 -0500 (Sat, 19 Sep 2009) | 1 line
Fix references to threading.enumerate().
........
r74954 | georg.brandl | 2009-09-19 08:13:56 -0500 (Sat, 19 Sep 2009) | 1 line
Add Doug.
........
r74955 | georg.brandl | 2009-09-19 08:20:49 -0500 (Sat, 19 Sep 2009) | 1 line
Add Mark Summerfield.
........
r75015 | georg.brandl | 2009-09-22 05:55:08 -0500 (Tue, 22 Sep 2009) | 1 line
Fix encoding name.
........
r75019 | vinay.sajip | 2009-09-22 12:23:41 -0500 (Tue, 22 Sep 2009) | 1 line
Fixed a typo, and added sections on optimization and using arbitrary objects as messages.
........
r75032 | benjamin.peterson | 2009-09-22 17:15:28 -0500 (Tue, 22 Sep 2009) | 1 line
fix typos/rephrase
........
r75068 | benjamin.peterson | 2009-09-25 21:57:59 -0500 (Fri, 25 Sep 2009) | 1 line
comment out ugly xxx
........
r75076 | vinay.sajip | 2009-09-26 09:53:32 -0500 (Sat, 26 Sep 2009) | 1 line
Tidied up name of parameter in StreamHandler
........
r75095 | michael.foord | 2009-09-27 14:15:41 -0500 (Sun, 27 Sep 2009) | 1 line
Test creation moved from TestProgram.parseArgs to TestProgram.createTests exclusively. Issue 6956.
........
r75098 | michael.foord | 2009-09-27 15:08:23 -0500 (Sun, 27 Sep 2009) | 1 line
Documentation improvement for load_tests protocol in unittest. Issue 6515.
........
r75102 | skip.montanaro | 2009-09-27 21:12:27 -0500 (Sun, 27 Sep 2009) | 3 lines
Patch from Thomas Barr so that csv.Sniffer will set doublequote property.
Closes issue 6606.
........
r75129 | vinay.sajip | 2009-09-29 02:08:54 -0500 (Tue, 29 Sep 2009) | 1 line
Issue #7014: logging: Improved IronPython 2.6 compatibility.
........
r75139 | raymond.hettinger | 2009-09-29 13:53:24 -0500 (Tue, 29 Sep 2009) | 3 lines
Issue 7008: Better document str.title and show how to work around the apostrophe problem.
........
r75230 | benjamin.peterson | 2009-10-04 08:38:38 -0500 (Sun, 04 Oct 2009) | 1 line
test logging
........
2009-10-04 11:49:41 -03:00
|
|
|
logging.basicConfig(filename=LOG_FILENAME,level=logging.DEBUG)
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
logging.debug('This message should go to the log file')
|
|
|
|
|
|
|
|
And now if we open the file and look at what we have, we should find the log
|
|
|
|
message::
|
|
|
|
|
|
|
|
DEBUG:root:This message should go to the log file
|
|
|
|
|
|
|
|
If you run the script repeatedly, the additional log messages are appended to
|
2009-06-04 15:20:51 -03:00
|
|
|
the file. To create a new file each time, you can pass a *filemode* argument to
|
2007-12-04 15:30:01 -04:00
|
|
|
:func:`basicConfig` with a value of ``'w'``. Rather than managing the file size
|
|
|
|
yourself, though, it is simpler to use a :class:`RotatingFileHandler`::
|
|
|
|
|
|
|
|
import glob
|
|
|
|
import logging
|
|
|
|
import logging.handlers
|
|
|
|
|
|
|
|
LOG_FILENAME = '/tmp/logging_rotatingfile_example.out'
|
|
|
|
|
|
|
|
# Set up a specific logger with our desired output level
|
|
|
|
my_logger = logging.getLogger('MyLogger')
|
|
|
|
my_logger.setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
# Add the log message handler to the logger
|
|
|
|
handler = logging.handlers.RotatingFileHandler(
|
|
|
|
LOG_FILENAME, maxBytes=20, backupCount=5)
|
|
|
|
|
|
|
|
my_logger.addHandler(handler)
|
|
|
|
|
|
|
|
# Log some messages
|
|
|
|
for i in range(20):
|
|
|
|
my_logger.debug('i = %d' % i)
|
|
|
|
|
|
|
|
# See what files are created
|
|
|
|
logfiles = glob.glob('%s*' % LOG_FILENAME)
|
|
|
|
|
|
|
|
for filename in logfiles:
|
2008-02-01 07:56:49 -04:00
|
|
|
print(filename)
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
The result should be 6 separate files, each with part of the log history for the
|
|
|
|
application::
|
|
|
|
|
|
|
|
/tmp/logging_rotatingfile_example.out
|
|
|
|
/tmp/logging_rotatingfile_example.out.1
|
|
|
|
/tmp/logging_rotatingfile_example.out.2
|
|
|
|
/tmp/logging_rotatingfile_example.out.3
|
|
|
|
/tmp/logging_rotatingfile_example.out.4
|
|
|
|
/tmp/logging_rotatingfile_example.out.5
|
|
|
|
|
|
|
|
The most current file is always :file:`/tmp/logging_rotatingfile_example.out`,
|
|
|
|
and each time it reaches the size limit it is renamed with the suffix
|
|
|
|
``.1``. Each of the existing backup files is renamed to increment the suffix
|
2009-06-04 15:20:51 -03:00
|
|
|
(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased.
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
Obviously this example sets the log length much much too small as an extreme
|
|
|
|
example. You would want to set *maxBytes* to an appropriate value.
|
|
|
|
|
|
|
|
Another useful feature of the logging API is the ability to produce different
|
|
|
|
messages at different log levels. This allows you to instrument your code with
|
|
|
|
debug messages, for example, but turning the log level down so that those debug
|
|
|
|
messages are not written for your production system. The default levels are
|
2009-10-28 20:28:16 -03:00
|
|
|
``NOTSET``, ``DEBUG``, ``INFO``, ``WARNING``, ``ERROR`` and ``CRITICAL``.
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
The logger, handler, and log message call each specify a level. The log message
|
|
|
|
is only emitted if the handler and logger are configured to emit messages of
|
|
|
|
that level or lower. For example, if a message is ``CRITICAL``, and the logger
|
|
|
|
is set to ``ERROR``, the message is emitted. If a message is a ``WARNING``, and
|
|
|
|
the logger is set to produce only ``ERROR``\s, the message is not emitted::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import sys
|
|
|
|
|
|
|
|
LEVELS = {'debug': logging.DEBUG,
|
|
|
|
'info': logging.INFO,
|
|
|
|
'warning': logging.WARNING,
|
|
|
|
'error': logging.ERROR,
|
|
|
|
'critical': logging.CRITICAL}
|
|
|
|
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
level_name = sys.argv[1]
|
|
|
|
level = LEVELS.get(level_name, logging.NOTSET)
|
|
|
|
logging.basicConfig(level=level)
|
|
|
|
|
|
|
|
logging.debug('This is a debug message')
|
|
|
|
logging.info('This is an info message')
|
|
|
|
logging.warning('This is a warning message')
|
|
|
|
logging.error('This is an error message')
|
|
|
|
logging.critical('This is a critical error message')
|
|
|
|
|
|
|
|
Run the script with an argument like 'debug' or 'warning' to see which messages
|
|
|
|
show up at different levels::
|
|
|
|
|
|
|
|
$ python logging_level_example.py debug
|
|
|
|
DEBUG:root:This is a debug message
|
|
|
|
INFO:root:This is an info message
|
|
|
|
WARNING:root:This is a warning message
|
|
|
|
ERROR:root:This is an error message
|
|
|
|
CRITICAL:root:This is a critical error message
|
|
|
|
|
|
|
|
$ python logging_level_example.py info
|
|
|
|
INFO:root:This is an info message
|
|
|
|
WARNING:root:This is a warning message
|
|
|
|
ERROR:root:This is an error message
|
|
|
|
CRITICAL:root:This is a critical error message
|
|
|
|
|
|
|
|
You will notice that these log messages all have ``root`` embedded in them. The
|
|
|
|
logging module supports a hierarchy of loggers with different names. An easy
|
|
|
|
way to tell where a specific log message comes from is to use a separate logger
|
|
|
|
object for each of your modules. Each new logger "inherits" the configuration
|
|
|
|
of its parent, and log messages sent to a logger include the name of that
|
|
|
|
logger. Optionally, each logger can be configured differently, so that messages
|
|
|
|
from different modules are handled in different ways. Let's look at a simple
|
|
|
|
example of how to log from different modules so it is easy to trace the source
|
|
|
|
of the message::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.WARNING)
|
|
|
|
|
|
|
|
logger1 = logging.getLogger('package1.module1')
|
|
|
|
logger2 = logging.getLogger('package2.module2')
|
|
|
|
|
|
|
|
logger1.warning('This message comes from one module')
|
|
|
|
logger2.warning('And this message comes from another module')
|
|
|
|
|
|
|
|
And the output::
|
|
|
|
|
|
|
|
$ python logging_modules_example.py
|
|
|
|
WARNING:package1.module1:This message comes from one module
|
|
|
|
WARNING:package2.module2:And this message comes from another module
|
|
|
|
|
|
|
|
There are many more options for configuring logging, including different log
|
|
|
|
message formatting options, having messages delivered to multiple destinations,
|
|
|
|
and changing the configuration of a long-running application on the fly using a
|
|
|
|
socket interface. All of these options are covered in depth in the library
|
|
|
|
module documentation.
|
|
|
|
|
|
|
|
Loggers
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
The logging library takes a modular approach and offers the several categories
|
|
|
|
of components: loggers, handlers, filters, and formatters. Loggers expose the
|
|
|
|
interface that application code directly uses. Handlers send the log records to
|
|
|
|
the appropriate destination. Filters provide a finer grained facility for
|
|
|
|
determining which log records to send on to a handler. Formatters specify the
|
|
|
|
layout of the resultant log record.
|
|
|
|
|
|
|
|
:class:`Logger` objects have a threefold job. First, they expose several
|
|
|
|
methods to application code so that applications can log messages at runtime.
|
|
|
|
Second, logger objects determine which log messages to act upon based upon
|
|
|
|
severity (the default filtering facility) or filter objects. Third, logger
|
|
|
|
objects pass along relevant log messages to all interested log handlers.
|
|
|
|
|
|
|
|
The most widely used methods on logger objects fall into two categories:
|
|
|
|
configuration and message sending.
|
|
|
|
|
|
|
|
* :meth:`Logger.setLevel` specifies the lowest-severity log message a logger
|
|
|
|
will handle, where debug is the lowest built-in severity level and critical is
|
|
|
|
the highest built-in severity. For example, if the severity level is info,
|
|
|
|
the logger will handle only info, warning, error, and critical messages and
|
|
|
|
will ignore debug messages.
|
|
|
|
|
|
|
|
* :meth:`Logger.addFilter` and :meth:`Logger.removeFilter` add and remove filter
|
|
|
|
objects from the logger object. This tutorial does not address filters.
|
|
|
|
|
|
|
|
With the logger object configured, the following methods create log messages:
|
|
|
|
|
|
|
|
* :meth:`Logger.debug`, :meth:`Logger.info`, :meth:`Logger.warning`,
|
|
|
|
:meth:`Logger.error`, and :meth:`Logger.critical` all create log records with
|
|
|
|
a message and a level that corresponds to their respective method names. The
|
|
|
|
message is actually a format string, which may contain the standard string
|
|
|
|
substitution syntax of :const:`%s`, :const:`%d`, :const:`%f`, and so on. The
|
|
|
|
rest of their arguments is a list of objects that correspond with the
|
|
|
|
substitution fields in the message. With regard to :const:`**kwargs`, the
|
|
|
|
logging methods care only about a keyword of :const:`exc_info` and use it to
|
|
|
|
determine whether to log exception information.
|
|
|
|
|
|
|
|
* :meth:`Logger.exception` creates a log message similar to
|
|
|
|
:meth:`Logger.error`. The difference is that :meth:`Logger.exception` dumps a
|
|
|
|
stack trace along with it. Call this method only from an exception handler.
|
|
|
|
|
|
|
|
* :meth:`Logger.log` takes a log level as an explicit argument. This is a
|
|
|
|
little more verbose for logging messages than using the log level convenience
|
|
|
|
methods listed above, but this is how to log at custom log levels.
|
|
|
|
|
2008-02-25 09:19:43 -04:00
|
|
|
:func:`getLogger` returns a reference to a logger instance with the specified
|
|
|
|
if it it is provided, or ``root`` if not. The names are period-separated
|
2007-12-04 15:30:01 -04:00
|
|
|
hierarchical structures. Multiple calls to :func:`getLogger` with the same name
|
|
|
|
will return a reference to the same logger object. Loggers that are further
|
|
|
|
down in the hierarchical list are children of loggers higher up in the list.
|
|
|
|
For example, given a logger with a name of ``foo``, loggers with names of
|
|
|
|
``foo.bar``, ``foo.bar.baz``, and ``foo.bam`` are all children of ``foo``.
|
|
|
|
Child loggers propagate messages up to their parent loggers. Because of this,
|
|
|
|
it is unnecessary to define and configure all the loggers an application uses.
|
|
|
|
It is sufficient to configure a top-level logger and create child loggers as
|
|
|
|
needed.
|
|
|
|
|
|
|
|
|
|
|
|
Handlers
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
:class:`Handler` objects are responsible for dispatching the appropriate log
|
|
|
|
messages (based on the log messages' severity) to the handler's specified
|
|
|
|
destination. Logger objects can add zero or more handler objects to themselves
|
|
|
|
with an :func:`addHandler` method. As an example scenario, an application may
|
|
|
|
want to send all log messages to a log file, all log messages of error or higher
|
|
|
|
to stdout, and all messages of critical to an email address. This scenario
|
Merged revisions 60481,60485,60489-60492,60494-60496,60498-60499,60501-60503,60505-60506,60508-60509,60523-60524,60532,60543,60545,60547-60548,60552,60554,60556-60559,60561-60562,60569,60571-60572,60574,60576-60583,60585-60586,60589,60591,60594-60595,60597-60598,60600-60601,60606-60612,60615,60617,60619-60621,60623-60625,60627-60629,60631,60633,60635,60647,60650,60652,60654,60656,60658-60659,60664-60666,60668-60670,60672,60676,60678,60680-60683,60685-60686,60688,60690,60692-60694,60697-60700,60705-60706,60708,60711,60714,60720,60724-60730,60732,60736,60742,60744,60746,60748,60750-60751,60753,60756-60757,60759-60761,60763-60764,60766,60769-60770,60774-60784,60787-60789,60793,60796,60799-60809,60812-60813,60815-60821,60823-60826,60828-60829,60831-60834,60836,60838-60839,60846-60849,60852-60854,60856-60859,60861-60870,60874-60875,60880-60881,60886,60888-60890,60892,60894-60898,60900-60931,60933-60958 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60901 | eric.smith | 2008-02-19 14:21:56 +0100 (Tue, 19 Feb 2008) | 1 line
Added PEP 3101.
........
r60907 | georg.brandl | 2008-02-20 20:12:36 +0100 (Wed, 20 Feb 2008) | 2 lines
Fixes contributed by Ori Avtalion.
........
r60909 | eric.smith | 2008-02-21 00:34:22 +0100 (Thu, 21 Feb 2008) | 1 line
Trim leading zeros from a floating point exponent, per C99. See issue 1600. As far as I know, this only affects Windows. Add float type 'n' to PyOS_ascii_formatd (see PEP 3101 for 'n' description).
........
r60910 | eric.smith | 2008-02-21 00:39:28 +0100 (Thu, 21 Feb 2008) | 1 line
Now that PyOS_ascii_formatd supports the 'n' format, simplify the float formatting code to just call it.
........
r60918 | andrew.kuchling | 2008-02-21 15:23:38 +0100 (Thu, 21 Feb 2008) | 2 lines
Close manifest file.
This change doesn't make any difference to CPython, but is a necessary fix for Jython.
........
r60921 | guido.van.rossum | 2008-02-21 18:46:16 +0100 (Thu, 21 Feb 2008) | 2 lines
Remove news about float repr() -- issue 1580 is still in limbo.
........
r60923 | guido.van.rossum | 2008-02-21 19:18:37 +0100 (Thu, 21 Feb 2008) | 5 lines
Removed uses of dict.has_key() from distutils, and uses of
callable() from copy_reg.py, so the interpreter now starts up
without warnings when '-3' is given. More work like this needs to
be done in the rest of the stdlib.
........
r60924 | thomas.heller | 2008-02-21 19:28:48 +0100 (Thu, 21 Feb 2008) | 4 lines
configure.ac: Remove the configure check for _Bool, it is already done in the
top-level Python configure script.
configure, fficonfig.h.in: regenerated.
........
r60925 | thomas.heller | 2008-02-21 19:52:20 +0100 (Thu, 21 Feb 2008) | 3 lines
Replace 'has_key()' with 'in'.
Replace 'raise Error, stuff' with 'raise Error(stuff)'.
........
r60927 | raymond.hettinger | 2008-02-21 20:24:53 +0100 (Thu, 21 Feb 2008) | 1 line
Update more instances of has_key().
........
r60928 | guido.van.rossum | 2008-02-21 20:46:35 +0100 (Thu, 21 Feb 2008) | 3 lines
Fix a few typos and layout glitches (more work is needed).
Move 2.5 news to Misc/HISTORY.
........
r60936 | georg.brandl | 2008-02-21 21:33:38 +0100 (Thu, 21 Feb 2008) | 2 lines
#2079: typo in userdict docs.
........
r60938 | georg.brandl | 2008-02-21 21:38:13 +0100 (Thu, 21 Feb 2008) | 2 lines
Part of #2154: minimal syntax fixes in doc example snippets.
........
r60942 | raymond.hettinger | 2008-02-22 04:16:42 +0100 (Fri, 22 Feb 2008) | 1 line
First draft for itertools.product(). Docs and other updates forthcoming.
........
r60955 | nick.coghlan | 2008-02-22 11:54:06 +0100 (Fri, 22 Feb 2008) | 1 line
Try to make command line error messages from runpy easier to understand (and suppress traceback cruft from the implicitly invoked runpy machinery)
........
r60956 | georg.brandl | 2008-02-22 13:31:45 +0100 (Fri, 22 Feb 2008) | 2 lines
A lot more typo fixes by Ori Avtalion.
........
r60957 | georg.brandl | 2008-02-22 13:56:34 +0100 (Fri, 22 Feb 2008) | 2 lines
Don't reference pyshell.
........
r60958 | georg.brandl | 2008-02-22 13:57:05 +0100 (Fri, 22 Feb 2008) | 2 lines
Another fix.
........
2008-02-22 12:37:40 -04:00
|
|
|
requires three individual handlers where each handler is responsible for sending
|
2007-12-04 15:30:01 -04:00
|
|
|
messages of a specific severity to a specific location.
|
|
|
|
|
|
|
|
The standard library includes quite a few handler types; this tutorial uses only
|
|
|
|
:class:`StreamHandler` and :class:`FileHandler` in its examples.
|
|
|
|
|
|
|
|
There are very few methods in a handler for application developers to concern
|
|
|
|
themselves with. The only handler methods that seem relevant for application
|
|
|
|
developers who are using the built-in handler objects (that is, not creating
|
|
|
|
custom handlers) are the following configuration methods:
|
|
|
|
|
|
|
|
* The :meth:`Handler.setLevel` method, just as in logger objects, specifies the
|
|
|
|
lowest severity that will be dispatched to the appropriate destination. Why
|
|
|
|
are there two :func:`setLevel` methods? The level set in the logger
|
|
|
|
determines which severity of messages it will pass to its handlers. The level
|
|
|
|
set in each handler determines which messages that handler will send on.
|
|
|
|
:func:`setFormatter` selects a Formatter object for this handler to use.
|
|
|
|
|
|
|
|
* :func:`addFilter` and :func:`removeFilter` respectively configure and
|
|
|
|
deconfigure filter objects on handlers.
|
|
|
|
|
|
|
|
Application code should not directly instantiate and use handlers. Instead, the
|
|
|
|
:class:`Handler` class is a base class that defines the interface that all
|
|
|
|
Handlers should have and establishes some default behavior that child classes
|
|
|
|
can use (or override).
|
|
|
|
|
|
|
|
|
|
|
|
Formatters
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
|
|
|
Formatter objects configure the final order, structure, and contents of the log
|
2008-02-25 09:19:43 -04:00
|
|
|
message. Unlike the base :class:`logging.Handler` class, application code may
|
2007-12-04 15:30:01 -04:00
|
|
|
instantiate formatter classes, although you could likely subclass the formatter
|
|
|
|
if your application needs special behavior. The constructor takes two optional
|
|
|
|
arguments: a message format string and a date format string. If there is no
|
|
|
|
message format string, the default is to use the raw message. If there is no
|
|
|
|
date format string, the default date format is::
|
|
|
|
|
|
|
|
%Y-%m-%d %H:%M:%S
|
|
|
|
|
|
|
|
with the milliseconds tacked on at the end.
|
|
|
|
|
|
|
|
The message format string uses ``%(<dictionary key>)s`` styled string
|
|
|
|
substitution; the possible keys are documented in :ref:`formatter-objects`.
|
|
|
|
|
|
|
|
The following message format string will log the time in a human-readable
|
|
|
|
format, the severity of the message, and the contents of the message, in that
|
|
|
|
order::
|
|
|
|
|
|
|
|
"%(asctime)s - %(levelname)s - %(message)s"
|
|
|
|
|
|
|
|
|
|
|
|
Configuring Logging
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Programmers can configure logging either by creating loggers, handlers, and
|
|
|
|
formatters explicitly in a main module with the configuration methods listed
|
|
|
|
above (using Python code), or by creating a logging config file. The following
|
|
|
|
code is an example of configuring a very simple logger, a console handler, and a
|
|
|
|
simple formatter in a Python module::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
# create logger
|
|
|
|
logger = logging.getLogger("simple_example")
|
|
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
# create console handler and set level to debug
|
|
|
|
ch = logging.StreamHandler()
|
|
|
|
ch.setLevel(logging.DEBUG)
|
|
|
|
# create formatter
|
|
|
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
|
|
|
# add formatter to ch
|
|
|
|
ch.setFormatter(formatter)
|
|
|
|
# add ch to logger
|
|
|
|
logger.addHandler(ch)
|
|
|
|
|
|
|
|
# "application" code
|
|
|
|
logger.debug("debug message")
|
|
|
|
logger.info("info message")
|
|
|
|
logger.warn("warn message")
|
|
|
|
logger.error("error message")
|
|
|
|
logger.critical("critical message")
|
|
|
|
|
|
|
|
Running this module from the command line produces the following output::
|
|
|
|
|
|
|
|
$ python simple_logging_module.py
|
|
|
|
2005-03-19 15:10:26,618 - simple_example - DEBUG - debug message
|
|
|
|
2005-03-19 15:10:26,620 - simple_example - INFO - info message
|
|
|
|
2005-03-19 15:10:26,695 - simple_example - WARNING - warn message
|
|
|
|
2005-03-19 15:10:26,697 - simple_example - ERROR - error message
|
|
|
|
2005-03-19 15:10:26,773 - simple_example - CRITICAL - critical message
|
|
|
|
|
|
|
|
The following Python module creates a logger, handler, and formatter nearly
|
|
|
|
identical to those in the example listed above, with the only difference being
|
|
|
|
the names of the objects::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import logging.config
|
|
|
|
|
|
|
|
logging.config.fileConfig("logging.conf")
|
|
|
|
|
|
|
|
# create logger
|
|
|
|
logger = logging.getLogger("simpleExample")
|
|
|
|
|
|
|
|
# "application" code
|
|
|
|
logger.debug("debug message")
|
|
|
|
logger.info("info message")
|
|
|
|
logger.warn("warn message")
|
|
|
|
logger.error("error message")
|
|
|
|
logger.critical("critical message")
|
|
|
|
|
|
|
|
Here is the logging.conf file::
|
|
|
|
|
|
|
|
[loggers]
|
|
|
|
keys=root,simpleExample
|
|
|
|
|
|
|
|
[handlers]
|
|
|
|
keys=consoleHandler
|
|
|
|
|
|
|
|
[formatters]
|
|
|
|
keys=simpleFormatter
|
|
|
|
|
|
|
|
[logger_root]
|
|
|
|
level=DEBUG
|
|
|
|
handlers=consoleHandler
|
|
|
|
|
|
|
|
[logger_simpleExample]
|
|
|
|
level=DEBUG
|
|
|
|
handlers=consoleHandler
|
|
|
|
qualname=simpleExample
|
|
|
|
propagate=0
|
|
|
|
|
|
|
|
[handler_consoleHandler]
|
|
|
|
class=StreamHandler
|
|
|
|
level=DEBUG
|
|
|
|
formatter=simpleFormatter
|
|
|
|
args=(sys.stdout,)
|
|
|
|
|
|
|
|
[formatter_simpleFormatter]
|
|
|
|
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
|
|
|
|
datefmt=
|
|
|
|
|
|
|
|
The output is nearly identical to that of the non-config-file-based example::
|
|
|
|
|
|
|
|
$ python simple_logging_config.py
|
|
|
|
2005-03-19 15:38:55,977 - simpleExample - DEBUG - debug message
|
|
|
|
2005-03-19 15:38:55,979 - simpleExample - INFO - info message
|
|
|
|
2005-03-19 15:38:56,054 - simpleExample - WARNING - warn message
|
|
|
|
2005-03-19 15:38:56,055 - simpleExample - ERROR - error message
|
|
|
|
2005-03-19 15:38:56,130 - simpleExample - CRITICAL - critical message
|
|
|
|
|
|
|
|
You can see that the config file approach has a few advantages over the Python
|
|
|
|
code approach, mainly separation of configuration and code and the ability of
|
|
|
|
noncoders to easily modify the logging properties.
|
|
|
|
|
2009-01-10 09:37:26 -04:00
|
|
|
.. _library-config:
|
2009-01-10 15:23:34 -04:00
|
|
|
|
Merged revisions 66045,66048-66049,66053,66060,66062-66063,66065,66067,66071-66074,66080,66082-66083,66090-66093,66097-66099,66103,66105,66110,66118 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66045 | andrew.kuchling | 2008-08-26 19:27:18 -0500 (Tue, 26 Aug 2008) | 1 line
Trim whitespace; add a few updates
........
r66048 | andrew.kuchling | 2008-08-26 19:45:02 -0500 (Tue, 26 Aug 2008) | 1 line
Add an item and a note
........
r66049 | andrew.kuchling | 2008-08-26 21:12:18 -0500 (Tue, 26 Aug 2008) | 1 line
Add various items
........
r66053 | georg.brandl | 2008-08-28 04:40:18 -0500 (Thu, 28 Aug 2008) | 2 lines
#3711: .dll isn't a valid Python extension anymore.
........
r66060 | armin.rigo | 2008-08-29 16:21:52 -0500 (Fri, 29 Aug 2008) | 3 lines
A collection of crashers, all variants of the idea
of issue #3720.
........
r66062 | georg.brandl | 2008-08-30 04:49:36 -0500 (Sat, 30 Aug 2008) | 2 lines
#3730: mention "server" attribute explicitly.
........
r66063 | georg.brandl | 2008-08-30 04:52:44 -0500 (Sat, 30 Aug 2008) | 2 lines
#3716: fix typo.
........
r66065 | georg.brandl | 2008-08-30 05:03:09 -0500 (Sat, 30 Aug 2008) | 2 lines
#3569: eval() also accepts "exec"able code objects.
........
r66067 | georg.brandl | 2008-08-30 08:17:39 -0500 (Sat, 30 Aug 2008) | 2 lines
super() actually returns a super object.
........
r66071 | andrew.kuchling | 2008-08-30 10:19:57 -0500 (Sat, 30 Aug 2008) | 1 line
Partial edits from revision and tidying pass
........
r66072 | andrew.kuchling | 2008-08-30 10:21:23 -0500 (Sat, 30 Aug 2008) | 1 line
Tidy up some sentences
........
r66073 | andrew.kuchling | 2008-08-30 10:25:47 -0500 (Sat, 30 Aug 2008) | 1 line
Correction from Antoine Pitrou: BufferedWriter and Reader support seek()
........
r66074 | andrew.kuchling | 2008-08-30 11:44:54 -0500 (Sat, 30 Aug 2008) | 1 line
Edit four more sections
........
r66080 | georg.brandl | 2008-08-30 17:00:28 -0500 (Sat, 30 Aug 2008) | 2 lines
Fix markup.
........
r66082 | andrew.kuchling | 2008-08-30 17:56:54 -0500 (Sat, 30 Aug 2008) | 1 line
More edits; markup fixes
........
r66083 | andrew.kuchling | 2008-08-30 21:24:08 -0500 (Sat, 30 Aug 2008) | 1 line
More edits
........
r66090 | andrew.kuchling | 2008-08-31 09:29:31 -0500 (Sun, 31 Aug 2008) | 1 line
Edit the library section, rearranging items to flow better and making lots of edits
........
r66091 | andrew.kuchling | 2008-08-31 10:41:48 -0500 (Sun, 31 Aug 2008) | 1 line
Last batch of edits; remove the 'other changes' section
........
r66092 | andrew.kuchling | 2008-08-31 10:48:44 -0500 (Sun, 31 Aug 2008) | 1 line
Update patch/bug count
........
r66093 | gregory.p.smith | 2008-08-31 11:34:18 -0500 (Sun, 31 Aug 2008) | 3 lines
issue3715: docstring representation of hex escaped string needs to be double
escaped.
........
r66097 | benjamin.peterson | 2008-09-01 09:13:43 -0500 (Mon, 01 Sep 2008) | 4 lines
#3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
........
r66098 | georg.brandl | 2008-09-01 09:15:55 -0500 (Mon, 01 Sep 2008) | 2 lines
#3749: fix c'n'p errors.
........
r66099 | benjamin.peterson | 2008-09-01 09:18:30 -0500 (Mon, 01 Sep 2008) | 4 lines
Fix compilation when --without-threads is given #3683
Reviewer: Georg Brandl, Benjamin Peterson
........
r66103 | vinay.sajip | 2008-09-01 09:30:10 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66105 | vinay.sajip | 2008-09-01 09:33:59 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66110 | vinay.sajip | 2008-09-01 10:08:07 -0500 (Mon, 01 Sep 2008) | 1 line
Added section about configuring logging in a library. Thanks to Thomas Heller for the idea.
........
r66118 | vinay.sajip | 2008-09-01 12:44:14 -0500 (Mon, 01 Sep 2008) | 1 line
Bug #3738: Documentation is now more accurate in describing handler close methods.
........
2008-09-01 21:31:15 -03:00
|
|
|
Configuring Logging for a Library
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
When developing a library which uses logging, some consideration needs to be
|
|
|
|
given to its configuration. If the using application does not use logging, and
|
|
|
|
library code makes logging calls, then a one-off message "No handlers could be
|
|
|
|
found for logger X.Y.Z" is printed to the console. This message is intended
|
|
|
|
to catch mistakes in logging configuration, but will confuse an application
|
|
|
|
developer who is not aware of logging by the library.
|
|
|
|
|
|
|
|
In addition to documenting how a library uses logging, a good way to configure
|
|
|
|
library logging so that it does not cause a spurious message is to add a
|
|
|
|
handler which does nothing. This avoids the message being printed, since a
|
|
|
|
handler will be found: it just doesn't produce any output. If the library user
|
|
|
|
configures logging for application use, presumably that configuration will add
|
|
|
|
some handlers, and if levels are suitably configured then logging calls made
|
|
|
|
in library code will send output to those handlers, as normal.
|
|
|
|
|
|
|
|
A do-nothing handler can be simply defined as follows::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
class NullHandler(logging.Handler):
|
|
|
|
def emit(self, record):
|
|
|
|
pass
|
|
|
|
|
|
|
|
An instance of this handler should be added to the top-level logger of the
|
|
|
|
logging namespace used by the library. If all logging by a library *foo* is
|
|
|
|
done using loggers with names matching "foo.x.y", then the code::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
h = NullHandler()
|
|
|
|
logging.getLogger("foo").addHandler(h)
|
|
|
|
|
|
|
|
should have the desired effect. If an organisation produces a number of
|
|
|
|
libraries, then the logger name specified can be "orgname.foo" rather than
|
|
|
|
just "foo".
|
|
|
|
|
2008-12-07 11:30:06 -04:00
|
|
|
.. versionadded:: 3.1
|
|
|
|
|
|
|
|
The :class:`NullHandler` class was not present in previous versions, but is now
|
|
|
|
included, so that it need not be defined in library code.
|
|
|
|
|
|
|
|
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
Logging Levels
|
|
|
|
--------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The numeric values of logging levels are given in the following table. These are
|
|
|
|
primarily of interest if you want to define your own levels, and need them to
|
|
|
|
have specific values relative to the predefined levels. If you define a level
|
|
|
|
with the same numeric value, it overwrites the predefined value; the predefined
|
|
|
|
name is lost.
|
|
|
|
|
|
|
|
+--------------+---------------+
|
|
|
|
| Level | Numeric value |
|
|
|
|
+==============+===============+
|
|
|
|
| ``CRITICAL`` | 50 |
|
|
|
|
+--------------+---------------+
|
|
|
|
| ``ERROR`` | 40 |
|
|
|
|
+--------------+---------------+
|
|
|
|
| ``WARNING`` | 30 |
|
|
|
|
+--------------+---------------+
|
|
|
|
| ``INFO`` | 20 |
|
|
|
|
+--------------+---------------+
|
|
|
|
| ``DEBUG`` | 10 |
|
|
|
|
+--------------+---------------+
|
|
|
|
| ``NOTSET`` | 0 |
|
|
|
|
+--------------+---------------+
|
|
|
|
|
|
|
|
Levels can also be associated with loggers, being set either by the developer or
|
|
|
|
through loading a saved logging configuration. When a logging method is called
|
|
|
|
on a logger, the logger compares its own level with the level associated with
|
|
|
|
the method call. If the logger's level is higher than the method call's, no
|
|
|
|
logging message is actually generated. This is the basic mechanism controlling
|
|
|
|
the verbosity of logging output.
|
|
|
|
|
|
|
|
Logging messages are encoded as instances of the :class:`LogRecord` class. When
|
|
|
|
a logger decides to actually log an event, a :class:`LogRecord` instance is
|
|
|
|
created from the logging message.
|
|
|
|
|
|
|
|
Logging messages are subjected to a dispatch mechanism through the use of
|
|
|
|
:dfn:`handlers`, which are instances of subclasses of the :class:`Handler`
|
|
|
|
class. Handlers are responsible for ensuring that a logged message (in the form
|
|
|
|
of a :class:`LogRecord`) ends up in a particular location (or set of locations)
|
|
|
|
which is useful for the target audience for that message (such as end users,
|
|
|
|
support desk staff, system administrators, developers). Handlers are passed
|
|
|
|
:class:`LogRecord` instances intended for particular destinations. Each logger
|
|
|
|
can have zero, one or more handlers associated with it (via the
|
|
|
|
:meth:`addHandler` method of :class:`Logger`). In addition to any handlers
|
|
|
|
directly associated with a logger, *all handlers associated with all ancestors
|
|
|
|
of the logger* are called to dispatch the message.
|
|
|
|
|
|
|
|
Just as for loggers, handlers can have levels associated with them. A handler's
|
|
|
|
level acts as a filter in the same way as a logger's level does. If a handler
|
|
|
|
decides to actually dispatch an event, the :meth:`emit` method is used to send
|
|
|
|
the message to its destination. Most user-defined subclasses of :class:`Handler`
|
|
|
|
will need to override this :meth:`emit`.
|
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
Useful Handlers
|
|
|
|
---------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
In addition to the base :class:`Handler` class, many useful subclasses are
|
|
|
|
provided:
|
|
|
|
|
|
|
|
#. :class:`StreamHandler` instances send error messages to streams (file-like
|
|
|
|
objects).
|
|
|
|
|
|
|
|
#. :class:`FileHandler` instances send error messages to disk files.
|
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
.. module:: logging.handlers
|
2009-01-10 15:23:34 -04:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`BaseRotatingHandler` is the base class for handlers that
|
|
|
|
rotate log files at a certain point. It is not meant to be instantiated
|
|
|
|
directly. Instead, use :class:`RotatingFileHandler` or
|
|
|
|
:class:`TimedRotatingFileHandler`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`RotatingFileHandler` instances send error messages to disk
|
|
|
|
files, with support for maximum log file sizes and log file rotation.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`TimedRotatingFileHandler` instances send error messages to
|
|
|
|
disk files, rotating the log file at certain timed intervals.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`SocketHandler` instances send error messages to TCP/IP
|
|
|
|
sockets.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`DatagramHandler` instances send error messages to UDP
|
|
|
|
sockets.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`SMTPHandler` instances send error messages to a designated
|
|
|
|
email address.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`SysLogHandler` instances send error messages to a Unix
|
|
|
|
syslog daemon, possibly on a remote machine.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`NTEventLogHandler` instances send error messages to a
|
|
|
|
Windows NT/2000/XP event log.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`MemoryHandler` instances send error messages to a buffer
|
|
|
|
in memory, which is flushed whenever specific criteria are met.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`HTTPHandler` instances send error messages to an HTTP
|
|
|
|
server using either ``GET`` or ``POST`` semantics.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
#. :class:`WatchedFileHandler` instances watch the file they are
|
|
|
|
logging to. If the file changes, it is closed and reopened using the file
|
|
|
|
name. This handler is only useful on Unix-like systems; Windows does not
|
|
|
|
support the underlying mechanism used.
|
2009-01-10 15:23:34 -04:00
|
|
|
|
|
|
|
.. currentmodule:: logging
|
|
|
|
|
2008-12-07 11:30:06 -04:00
|
|
|
#. :class:`NullHandler` instances do nothing with error messages. They are used
|
|
|
|
by library developers who want to use logging, but want to avoid the "No
|
|
|
|
handlers could be found for logger XXX" message which can be displayed if
|
2009-01-10 09:37:26 -04:00
|
|
|
the library user has not configured logging. See :ref:`library-config` for
|
|
|
|
more information.
|
2008-12-07 11:30:06 -04:00
|
|
|
|
|
|
|
.. versionadded:: 3.1
|
|
|
|
|
|
|
|
The :class:`NullHandler` class was not present in previous versions.
|
|
|
|
|
2008-12-30 03:32:59 -04:00
|
|
|
The :class:`NullHandler`, :class:`StreamHandler` and :class:`FileHandler`
|
|
|
|
classes are defined in the core logging package. The other handlers are
|
|
|
|
defined in a sub- module, :mod:`logging.handlers`. (There is also another
|
|
|
|
sub-module, :mod:`logging.config`, for configuration functionality.)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logged messages are formatted for presentation through instances of the
|
|
|
|
:class:`Formatter` class. They are initialized with a format string suitable for
|
|
|
|
use with the % operator and a dictionary.
|
|
|
|
|
|
|
|
For formatting multiple messages in a batch, instances of
|
|
|
|
:class:`BufferingFormatter` can be used. In addition to the format string (which
|
|
|
|
is applied to each message in the batch), there is provision for header and
|
|
|
|
trailer format strings.
|
|
|
|
|
|
|
|
When filtering based on logger level and/or handler level is not enough,
|
|
|
|
instances of :class:`Filter` can be added to both :class:`Logger` and
|
|
|
|
:class:`Handler` instances (through their :meth:`addFilter` method). Before
|
|
|
|
deciding to process a message further, both loggers and handlers consult all
|
|
|
|
their filters for permission. If any filter returns a false value, the message
|
|
|
|
is not processed further.
|
|
|
|
|
|
|
|
The basic :class:`Filter` functionality allows filtering by specific logger
|
|
|
|
name. If this feature is used, messages sent to the named logger and its
|
|
|
|
children are allowed through the filter, and all others dropped.
|
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
Module-Level Functions
|
|
|
|
----------------------
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
In addition to the classes described above, there are a number of module- level
|
|
|
|
functions.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: getLogger(name=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
Return a logger with the specified name or, if name is ``None``, return a
|
2007-08-15 11:28:22 -03:00
|
|
|
logger which is the root logger of the hierarchy. If specified, the name is
|
|
|
|
typically a dot-separated hierarchical name like *"a"*, *"a.b"* or *"a.b.c.d"*.
|
|
|
|
Choice of these names is entirely up to the developer who is using logging.
|
|
|
|
|
|
|
|
All calls to this function with a given name return the same logger instance.
|
|
|
|
This means that logger instances never need to be passed between different parts
|
|
|
|
of an application.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getLoggerClass()
|
|
|
|
|
|
|
|
Return either the standard :class:`Logger` class, or the last class passed to
|
|
|
|
:func:`setLoggerClass`. This function may be called from within a new class
|
|
|
|
definition, to ensure that installing a customised :class:`Logger` class will
|
|
|
|
not undo customisations already applied by other code. For example::
|
|
|
|
|
|
|
|
class MyLogger(logging.getLoggerClass()):
|
|
|
|
# ... override behaviour here
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: debug(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`DEBUG` on the root logger. The *msg* is the
|
|
|
|
message format string, and the *args* are the arguments which are merged into
|
|
|
|
*msg* using the string formatting operator. (Note that this means that you can
|
|
|
|
use keywords in the format string, together with a single dictionary argument.)
|
|
|
|
|
|
|
|
There are two keyword arguments in *kwargs* which are inspected: *exc_info*
|
|
|
|
which, if it does not evaluate as false, causes exception information to be
|
|
|
|
added to the logging message. If an exception tuple (in the format returned by
|
|
|
|
:func:`sys.exc_info`) is provided, it is used; otherwise, :func:`sys.exc_info`
|
|
|
|
is called to get the exception information.
|
|
|
|
|
|
|
|
The other optional keyword argument is *extra* which can be used to pass a
|
|
|
|
dictionary which is used to populate the __dict__ of the LogRecord created for
|
|
|
|
the logging event with user-defined attributes. These custom attributes can then
|
|
|
|
be used as you like. For example, they could be incorporated into logged
|
|
|
|
messages. For example::
|
|
|
|
|
|
|
|
FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s"
|
|
|
|
logging.basicConfig(format=FORMAT)
|
|
|
|
d = {'clientip': '192.168.0.1', 'user': 'fbloggs'}
|
|
|
|
logging.warning("Protocol problem: %s", "connection reset", extra=d)
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
would print something like ::
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset
|
|
|
|
|
|
|
|
The keys in the dictionary passed in *extra* should not clash with the keys used
|
|
|
|
by the logging system. (See the :class:`Formatter` documentation for more
|
|
|
|
information on which keys are used by the logging system.)
|
|
|
|
|
|
|
|
If you choose to use these attributes in logged messages, you need to exercise
|
|
|
|
some care. In the above example, for instance, the :class:`Formatter` has been
|
|
|
|
set up with a format string which expects 'clientip' and 'user' in the attribute
|
|
|
|
dictionary of the LogRecord. If these are missing, the message will not be
|
|
|
|
logged because a string formatting exception will occur. So in this case, you
|
|
|
|
always need to pass the *extra* dictionary with these keys.
|
|
|
|
|
|
|
|
While this might be annoying, this feature is intended for use in specialized
|
|
|
|
circumstances, such as multi-threaded servers where the same code executes in
|
|
|
|
many contexts, and interesting conditions which arise are dependent on this
|
|
|
|
context (such as remote client IP address and authenticated user name, in the
|
|
|
|
above example). In such circumstances, it is likely that specialized
|
|
|
|
:class:`Formatter`\ s would be used with particular :class:`Handler`\ s.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: info(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`INFO` on the root logger. The arguments are
|
|
|
|
interpreted as for :func:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: warning(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`WARNING` on the root logger. The arguments are
|
|
|
|
interpreted as for :func:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: error(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`ERROR` on the root logger. The arguments are
|
|
|
|
interpreted as for :func:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: critical(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`CRITICAL` on the root logger. The arguments
|
|
|
|
are interpreted as for :func:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: exception(msg, *args)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`ERROR` on the root logger. The arguments are
|
|
|
|
interpreted as for :func:`debug`. Exception info is added to the logging
|
|
|
|
message. This function should only be called from an exception handler.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: log(level, msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level *level* on the root logger. The other arguments are
|
|
|
|
interpreted as for :func:`debug`.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: disable(lvl)
|
|
|
|
|
|
|
|
Provides an overriding level *lvl* for all loggers which takes precedence over
|
|
|
|
the logger's own level. When the need arises to temporarily throttle logging
|
|
|
|
output down across the whole application, this function can be useful.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: addLevelName(lvl, levelName)
|
|
|
|
|
|
|
|
Associates level *lvl* with text *levelName* in an internal dictionary, which is
|
|
|
|
used to map numeric levels to a textual representation, for example when a
|
|
|
|
:class:`Formatter` formats a message. This function can also be used to define
|
|
|
|
your own levels. The only constraints are that all levels used must be
|
|
|
|
registered using this function, levels should be positive integers and they
|
|
|
|
should increase in increasing order of severity.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: getLevelName(lvl)
|
|
|
|
|
|
|
|
Returns the textual representation of logging level *lvl*. If the level is one
|
|
|
|
of the predefined levels :const:`CRITICAL`, :const:`ERROR`, :const:`WARNING`,
|
|
|
|
:const:`INFO` or :const:`DEBUG` then you get the corresponding string. If you
|
|
|
|
have associated levels with names using :func:`addLevelName` then the name you
|
|
|
|
have associated with *lvl* is returned. If a numeric value corresponding to one
|
|
|
|
of the defined levels is passed in, the corresponding string representation is
|
|
|
|
returned. Otherwise, the string "Level %s" % lvl is returned.
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: makeLogRecord(attrdict)
|
|
|
|
|
|
|
|
Creates and returns a new :class:`LogRecord` instance whose attributes are
|
|
|
|
defined by *attrdict*. This function is useful for taking a pickled
|
|
|
|
:class:`LogRecord` attribute dictionary, sent over a socket, and reconstituting
|
|
|
|
it as a :class:`LogRecord` instance at the receiving end.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: basicConfig(**kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Does basic configuration for the logging system by creating a
|
|
|
|
:class:`StreamHandler` with a default :class:`Formatter` and adding it to the
|
2009-10-10 17:32:36 -03:00
|
|
|
root logger. The functions :func:`debug`, :func:`info`, :func:`warning`,
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`error` and :func:`critical` will call :func:`basicConfig` automatically
|
|
|
|
if no handlers are defined for the root logger.
|
|
|
|
|
2009-10-10 17:32:36 -03:00
|
|
|
This function does nothing if the root logger already has handlers
|
|
|
|
configured for it.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The following keyword arguments are supported.
|
|
|
|
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| Format | Description |
|
|
|
|
+==============+=============================================+
|
|
|
|
| ``filename`` | Specifies that a FileHandler be created, |
|
|
|
|
| | using the specified filename, rather than a |
|
|
|
|
| | StreamHandler. |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| ``filemode`` | Specifies the mode to open the file, if |
|
|
|
|
| | filename is specified (if filemode is |
|
|
|
|
| | unspecified, it defaults to 'a'). |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| ``format`` | Use the specified format string for the |
|
|
|
|
| | handler. |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| ``datefmt`` | Use the specified date/time format. |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| ``level`` | Set the root logger level to the specified |
|
|
|
|
| | level. |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
| ``stream`` | Use the specified stream to initialize the |
|
|
|
|
| | StreamHandler. Note that this argument is |
|
|
|
|
| | incompatible with 'filename' - if both are |
|
|
|
|
| | present, 'stream' is ignored. |
|
|
|
|
+--------------+---------------------------------------------+
|
|
|
|
|
|
|
|
|
|
|
|
.. function:: shutdown()
|
|
|
|
|
|
|
|
Informs the logging system to perform an orderly shutdown by flushing and
|
Merged revisions 61431,61433-61436,61439,61444,61449-61450,61453,61458,61465,61468,61471-61474,61480,61483-61484,61488,61495-61496,61498,61503-61504,61507,61509-61510,61515-61518 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61431 | vinay.sajip | 2008-03-16 22:35:58 +0100 (So, 16 Mär 2008) | 1 line
Clarified documentation on use of shutdown().
........
r61433 | mark.summerfield | 2008-03-17 09:28:15 +0100 (Mo, 17 Mär 2008) | 5 lines
Added a footnote to each pointing out that for XML output if an encoding
string is given it should conform to the appropriate XML standards---for
example, "UTF-8" is okay, but "UTF8" is not.
........
r61434 | eric.smith | 2008-03-17 12:01:01 +0100 (Mo, 17 Mär 2008) | 7 lines
Issue 2264: empty float presentation type needs to have at least one digit past the decimal point.
Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type.
Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning.
Modified format.__float__ to use the new "Z" format as the default.
Added test cases.
........
r61435 | eric.smith | 2008-03-17 13:14:29 +0100 (Mo, 17 Mär 2008) | 2 lines
Reformated lines > 79 chars.
Deleted unused macro ISXDIGIT.
........
r61436 | jeffrey.yasskin | 2008-03-17 15:40:53 +0100 (Mo, 17 Mär 2008) | 13 lines
Allow Gnu gcc's to build python on OSX by removing -Wno-long-double,
-no-cpp-precomp, and -mno-fused-madd from configure.
* r22183 added -no-cpp-precomp, which
http://gcc.gnu.org/ml/gcc/2005-12/msg00368.html claims hasn't been
needed since gcc-3.1.
* r25607 added -Wno-long-double to avoid a warning in
Include/objimpl.h (issue 525481). The long double is still there,
but OSX 10.4's gcc no longer warns about it.
* r33666 fixed issue 775892 on OSX 10.3 by adding -mno-fused-madd,
which changed the sign of some float 0s. Tim Peters said it wasn't
a real issue anyway, and it no longer causes test failures.
Fixes issue #1779871.
........
r61439 | martin.v.loewis | 2008-03-17 17:31:57 +0100 (Mo, 17 Mär 2008) | 2 lines
Add Trent Nelson.
........
r61444 | travis.oliphant | 2008-03-17 18:36:12 +0100 (Mo, 17 Mär 2008) | 1 line
Add necessary headers to back-port new buffer protocol to Python 2.6
........
r61449 | gregory.p.smith | 2008-03-17 19:48:05 +0100 (Mo, 17 Mär 2008) | 8 lines
Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.
This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.
Fixes Issue1202 for Python 2.6
........
r61450 | neal.norwitz | 2008-03-17 20:02:45 +0100 (Mo, 17 Mär 2008) | 3 lines
Use a buffer large enough to ensure we don't overrun, even if the value
is outside the range we expect.
........
r61453 | steven.bethard | 2008-03-17 20:33:11 +0100 (Mo, 17 Mär 2008) | 1 line
Document unicode.isnumeric() and unicode.isdecimal() (issue2326)
........
r61458 | neal.norwitz | 2008-03-17 21:22:43 +0100 (Mo, 17 Mär 2008) | 5 lines
Issue 2321: reduce memory usage (increase the memory that is returned
to the system) by using pymalloc for the data of unicode objects.
Will backport.
........
r61465 | martin.v.loewis | 2008-03-17 22:55:30 +0100 (Mo, 17 Mär 2008) | 2 lines
Add David Wolever.
........
r61468 | gregory.p.smith | 2008-03-18 01:20:01 +0100 (Di, 18 Mär 2008) | 3 lines
Fix the IOError message text when opening a file with an invalid filename.
Error reported by Ilan Schnell.
........
r61471 | brett.cannon | 2008-03-18 02:00:07 +0100 (Di, 18 Mär 2008) | 2 lines
Convert test_strftime, test_getargs, and test_pep247 to use unittest.
........
r61472 | jeffrey.yasskin | 2008-03-18 02:09:59 +0100 (Di, 18 Mär 2008) | 2 lines
Fix build on platforms that don't have intptr_t. Patch by Joseph Armbruster.
........
r61473 | brett.cannon | 2008-03-18 02:50:25 +0100 (Di, 18 Mär 2008) | 2 lines
Convert test_dummy_threading and test_dbm to unittest.
........
r61474 | brett.cannon | 2008-03-18 02:58:56 +0100 (Di, 18 Mär 2008) | 2 lines
Move test_extcall to doctest.
........
r61480 | brett.cannon | 2008-03-18 04:46:22 +0100 (Di, 18 Mär 2008) | 2 lines
test_errno was a no-op test; now it actually tests things and uses unittest.
........
r61483 | brett.cannon | 2008-03-18 05:09:00 +0100 (Di, 18 Mär 2008) | 3 lines
Remove our implementation of memmove() and strerror(); both are in the C89
standard library.
........
r61484 | brett.cannon | 2008-03-18 05:16:06 +0100 (Di, 18 Mär 2008) | 2 lines
The output directory for tests that compare against stdout is now gone!
........
r61488 | jeffrey.yasskin | 2008-03-18 05:29:35 +0100 (Di, 18 Mär 2008) | 2 lines
Block the "socket.ssl() is deprecated" warning from test_socket_ssl.
........
r61495 | jeffrey.yasskin | 2008-03-18 05:56:06 +0100 (Di, 18 Mär 2008) | 4 lines
Speed test_thread up from 51.328s to 0.081s by reducing its sleep times. We
still sleep at all to make it likely that all threads are active at the same
time.
........
r61496 | jeffrey.yasskin | 2008-03-18 06:12:41 +0100 (Di, 18 Mär 2008) | 4 lines
Speed up test_dict by about 10x by only checking selected dict literal sizes,
instead of every integer from 0 to 400. Exhaustive testing wastes time without
providing enough more assurance that the code is correct.
........
r61498 | neal.norwitz | 2008-03-18 06:20:29 +0100 (Di, 18 Mär 2008) | 1 line
Try increasing the timeout to reduce the flakiness of this test.
........
r61503 | brett.cannon | 2008-03-18 06:43:04 +0100 (Di, 18 Mär 2008) | 2 lines
Improve the error message for a test that failed on the S-390 Debian buildbot.
........
r61504 | jeffrey.yasskin | 2008-03-18 06:45:40 +0100 (Di, 18 Mär 2008) | 3 lines
Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
their times.
........
r61507 | neal.norwitz | 2008-03-18 07:03:46 +0100 (Di, 18 Mär 2008) | 1 line
Add some info to the failure messages
........
r61509 | trent.nelson | 2008-03-18 08:02:12 +0100 (Di, 18 Mär 2008) | 1 line
Issue 2286: bump up the stack size of the 64-bit debug python_d.exe to 2100000. The default value of 200000 causes a stack overflow at 1965 iterations of r_object() in marshal.c, 35 iterations before the 2000 limit enforced by MAX_MARSHAL_STACK_DEPTH.
........
r61510 | trent.nelson | 2008-03-18 08:32:47 +0100 (Di, 18 Mär 2008) | 5 lines
The behaviour of winsound.Beep() seems to differ between different versions of Windows when there's either:
a) no sound card entirely
b) legacy beep driver has been disabled
c) the legacy beep driver has been uninstalled
Sometimes RuntimeErrors are raised, sometimes they're not. If _have_soundcard() returns False, don't expect winsound.Beep() to raise a RuntimeError, as this clearly isn't the case, as demonstrated by the various Win32 XP buildbots.
........
r61515 | martin.v.loewis | 2008-03-18 13:20:15 +0100 (Di, 18 Mär 2008) | 2 lines
norwitz-amd64 (gentoo) has EREMOTEIO.
........
r61516 | martin.v.loewis | 2008-03-18 13:45:37 +0100 (Di, 18 Mär 2008) | 2 lines
Add more Linux error codes.
........
r61517 | martin.v.loewis | 2008-03-18 14:05:03 +0100 (Di, 18 Mär 2008) | 2 lines
Add WSA errors.
........
r61518 | martin.v.loewis | 2008-03-18 14:16:05 +0100 (Di, 18 Mär 2008) | 2 lines
Note that the stderr output of the test is intentional.
........
2008-03-18 12:15:01 -03:00
|
|
|
closing all handlers. This should be called at application exit and no
|
|
|
|
further use of the logging system should be made after this call.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: setLoggerClass(klass)
|
|
|
|
|
|
|
|
Tells the logging system to use the class *klass* when instantiating a logger.
|
|
|
|
The class should define :meth:`__init__` such that only a name argument is
|
|
|
|
required, and the :meth:`__init__` should call :meth:`Logger.__init__`. This
|
|
|
|
function is typically called before any loggers are instantiated by applications
|
|
|
|
which need to use custom logger behavior.
|
|
|
|
|
|
|
|
|
|
|
|
.. seealso::
|
|
|
|
|
|
|
|
:pep:`282` - A Logging System
|
|
|
|
The proposal which described this feature for inclusion in the Python standard
|
|
|
|
library.
|
|
|
|
|
Merged revisions 59376-59406 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59377 | georg.brandl | 2007-12-06 01:24:23 +0100 (Thu, 06 Dec 2007) | 2 lines
Add another GHOP student to ACKS.
........
r59378 | raymond.hettinger | 2007-12-06 01:56:53 +0100 (Thu, 06 Dec 2007) | 5 lines
Fix Issue 1045.
Factor-out common calling code by simplifying the length_hint API.
Speed-up the function by caching the PyObject_String for the attribute lookup.
........
r59380 | georg.brandl | 2007-12-06 02:52:24 +0100 (Thu, 06 Dec 2007) | 2 lines
Diverse markup fixes.
........
r59383 | georg.brandl | 2007-12-06 10:45:39 +0100 (Thu, 06 Dec 2007) | 2 lines
Better re.split examples.
........
r59386 | christian.heimes | 2007-12-06 14:15:13 +0100 (Thu, 06 Dec 2007) | 2 lines
Fixed get_config_h_filename for Windows. Without the patch it can't find the pyconfig.h file inside a build tree.
Added several small unit tests for sysconfig.
........
r59387 | christian.heimes | 2007-12-06 14:30:11 +0100 (Thu, 06 Dec 2007) | 1 line
Silence more warnings, _CRT_NONSTDC_NO_DEPRECATE is already defined in pyconfig.h but several projects don't include it.
........
r59389 | christian.heimes | 2007-12-06 14:55:01 +0100 (Thu, 06 Dec 2007) | 1 line
Disabled one test that is failing on Unix
........
r59399 | christian.heimes | 2007-12-06 22:13:06 +0100 (Thu, 06 Dec 2007) | 8 lines
Several Windows related cleanups:
* Removed a #define from pyconfig.h. The macro was already defined a few lines higher.
* Fixed path to tix in the build_tkinter.py script
* Changed make_buildinfo.c to use versions of unlink and strcat which are considered safe by Windows (as suggested by MvL).
* Removed two defines from pyproject.vsprops that are no longer required. Both are defined in pyconfig.h and make_buildinfo.c doesn't use the unsafe versions any more (as suggested by MvL).
* Added some more information about PGO and the property files to PCbuild9/readme.txt.
Are you fine with the changes, Martin?
........
r59400 | raymond.hettinger | 2007-12-07 02:53:01 +0100 (Fri, 07 Dec 2007) | 4 lines
Don't have the docs berate themselves. Keep a professional tone.
If a todo is needed, put it in the tracker.
........
r59402 | georg.brandl | 2007-12-07 10:07:10 +0100 (Fri, 07 Dec 2007) | 3 lines
Increase unit test coverage of SimpleXMLRPCServer.
Written for GHOP by Turkay Eren.
........
r59406 | georg.brandl | 2007-12-07 16:16:57 +0100 (Fri, 07 Dec 2007) | 2 lines
Update to windows doc from Robert.
........
2007-12-08 11:33:56 -04:00
|
|
|
`Original Python logging package <http://www.red-dove.com/python_logging.html>`_
|
2007-08-15 11:28:22 -03:00
|
|
|
This is the original source for the :mod:`logging` package. The version of the
|
|
|
|
package available from this site is suitable for use with Python 1.5.2, 2.1.x
|
|
|
|
and 2.2.x, which do not include the :mod:`logging` package in the standard
|
|
|
|
library.
|
|
|
|
|
|
|
|
|
|
|
|
Logger Objects
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Loggers have the following attributes and methods. Note that Loggers are never
|
|
|
|
instantiated directly, but always through the module-level function
|
|
|
|
``logging.getLogger(name)``.
|
|
|
|
|
|
|
|
|
|
|
|
.. attribute:: Logger.propagate
|
|
|
|
|
|
|
|
If this evaluates to false, logging messages are not passed by this logger or by
|
|
|
|
child loggers to higher level (ancestor) loggers. The constructor sets this
|
|
|
|
attribute to 1.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.setLevel(lvl)
|
|
|
|
|
|
|
|
Sets the threshold for this logger to *lvl*. Logging messages which are less
|
|
|
|
severe than *lvl* will be ignored. When a logger is created, the level is set to
|
|
|
|
:const:`NOTSET` (which causes all messages to be processed when the logger is
|
|
|
|
the root logger, or delegation to the parent when the logger is a non-root
|
|
|
|
logger). Note that the root logger is created with level :const:`WARNING`.
|
|
|
|
|
|
|
|
The term "delegation to the parent" means that if a logger has a level of
|
|
|
|
NOTSET, its chain of ancestor loggers is traversed until either an ancestor with
|
|
|
|
a level other than NOTSET is found, or the root is reached.
|
|
|
|
|
|
|
|
If an ancestor is found with a level other than NOTSET, then that ancestor's
|
|
|
|
level is treated as the effective level of the logger where the ancestor search
|
|
|
|
began, and is used to determine how a logging event is handled.
|
|
|
|
|
|
|
|
If the root is reached, and it has a level of NOTSET, then all messages will be
|
|
|
|
processed. Otherwise, the root's level will be used as the effective level.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.isEnabledFor(lvl)
|
|
|
|
|
|
|
|
Indicates if a message of severity *lvl* would be processed by this logger.
|
|
|
|
This method checks first the module-level level set by
|
|
|
|
``logging.disable(lvl)`` and then the logger's effective level as determined
|
|
|
|
by :meth:`getEffectiveLevel`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.getEffectiveLevel()
|
|
|
|
|
|
|
|
Indicates the effective level for this logger. If a value other than
|
|
|
|
:const:`NOTSET` has been set using :meth:`setLevel`, it is returned. Otherwise,
|
|
|
|
the hierarchy is traversed towards the root until a value other than
|
|
|
|
:const:`NOTSET` is found, and that value is returned.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.debug(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`DEBUG` on this logger. The *msg* is the
|
|
|
|
message format string, and the *args* are the arguments which are merged into
|
|
|
|
*msg* using the string formatting operator. (Note that this means that you can
|
|
|
|
use keywords in the format string, together with a single dictionary argument.)
|
|
|
|
|
|
|
|
There are two keyword arguments in *kwargs* which are inspected: *exc_info*
|
|
|
|
which, if it does not evaluate as false, causes exception information to be
|
|
|
|
added to the logging message. If an exception tuple (in the format returned by
|
|
|
|
:func:`sys.exc_info`) is provided, it is used; otherwise, :func:`sys.exc_info`
|
|
|
|
is called to get the exception information.
|
|
|
|
|
|
|
|
The other optional keyword argument is *extra* which can be used to pass a
|
|
|
|
dictionary which is used to populate the __dict__ of the LogRecord created for
|
|
|
|
the logging event with user-defined attributes. These custom attributes can then
|
|
|
|
be used as you like. For example, they could be incorporated into logged
|
|
|
|
messages. For example::
|
|
|
|
|
|
|
|
FORMAT = "%(asctime)-15s %(clientip)s %(user)-8s %(message)s"
|
|
|
|
logging.basicConfig(format=FORMAT)
|
#1370: Finish the merge r58749, log below, by resolving all conflicts in Doc/.
Merged revisions 58221-58741 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r58221 | georg.brandl | 2007-09-20 10:57:59 -0700 (Thu, 20 Sep 2007) | 2 lines
Patch #1181: add os.environ.clear() method.
........
r58225 | sean.reifschneider | 2007-09-20 23:33:28 -0700 (Thu, 20 Sep 2007) | 3 lines
Issue1704287: "make install" fails unless you do "make" first. Make
oldsharedmods and sharedmods in "libinstall".
........
r58232 | guido.van.rossum | 2007-09-22 13:18:03 -0700 (Sat, 22 Sep 2007) | 4 lines
Patch # 188 by Philip Jenvey.
Make tell() mark CRLF as a newline.
With unit test.
........
r58242 | georg.brandl | 2007-09-24 10:55:47 -0700 (Mon, 24 Sep 2007) | 2 lines
Fix typo and double word.
........
r58245 | georg.brandl | 2007-09-24 10:59:28 -0700 (Mon, 24 Sep 2007) | 2 lines
#1196: document default radix for int().
........
r58247 | georg.brandl | 2007-09-24 11:08:24 -0700 (Mon, 24 Sep 2007) | 2 lines
#1177: accept 2xx responses for https too, not only http.
........
r58249 | andrew.kuchling | 2007-09-24 16:45:51 -0700 (Mon, 24 Sep 2007) | 1 line
Remove stray odd character; grammar fix
........
r58250 | andrew.kuchling | 2007-09-24 16:46:28 -0700 (Mon, 24 Sep 2007) | 1 line
Typo fix
........
r58251 | andrew.kuchling | 2007-09-24 17:09:42 -0700 (Mon, 24 Sep 2007) | 1 line
Add various items
........
r58268 | vinay.sajip | 2007-09-26 22:34:45 -0700 (Wed, 26 Sep 2007) | 1 line
Change to flush and close logic to fix #1760556.
........
r58269 | vinay.sajip | 2007-09-26 22:38:51 -0700 (Wed, 26 Sep 2007) | 1 line
Change to basicConfig() to fix #1021.
........
r58270 | georg.brandl | 2007-09-26 23:26:58 -0700 (Wed, 26 Sep 2007) | 2 lines
#1208: document match object's boolean value.
........
r58271 | vinay.sajip | 2007-09-26 23:56:13 -0700 (Wed, 26 Sep 2007) | 1 line
Minor date change.
........
r58272 | vinay.sajip | 2007-09-27 00:35:10 -0700 (Thu, 27 Sep 2007) | 1 line
Change to LogRecord.__init__() to fix #1206. Note that archaic use of type(x) == types.DictType is because of keeping 1.5.2 compatibility. While this is much less relevant these days, there probably needs to be a separate commit for removing all archaic constructs at the same time.
........
r58288 | brett.cannon | 2007-09-30 12:45:10 -0700 (Sun, 30 Sep 2007) | 9 lines
tuple.__repr__ did not consider a reference loop as it is not possible from
Python code; but it is possible from C. object.__str__ had the issue of not
expecting a type to doing something within it's tp_str implementation that
could trigger an infinite recursion, but it could in C code.. Both found
thanks to BaseException and how it handles its repr.
Closes issue #1686386. Thanks to Thomas Herve for taking an initial stab at
coming up with a solution.
........
r58289 | brett.cannon | 2007-09-30 13:37:19 -0700 (Sun, 30 Sep 2007) | 3 lines
Fix error introduced by r58288; if a tuple is length 0 return its repr and
don't worry about any self-referring tuples.
........
r58294 | facundo.batista | 2007-10-02 10:01:24 -0700 (Tue, 02 Oct 2007) | 11 lines
Made the various is_* operations return booleans. This was discussed
with Cawlishaw by mail, and he basically confirmed that to these is_*
operations, there's no need to return Decimal(0) and Decimal(1) if
the language supports the False and True booleans.
Also added a few tests for the these functions in extra.decTest, since
they are mostly untested (apart from the doctests).
Thanks Mark Dickinson
........
r58295 | facundo.batista | 2007-10-02 11:21:18 -0700 (Tue, 02 Oct 2007) | 4 lines
Added a class to store the digits of log(10), so that they can be made
available when necessary without recomputing. Thanks Mark Dickinson
........
r58299 | mark.summerfield | 2007-10-03 01:53:21 -0700 (Wed, 03 Oct 2007) | 4 lines
Added note in footnote about string comparisons about
unicodedata.normalize().
........
r58304 | raymond.hettinger | 2007-10-03 14:18:11 -0700 (Wed, 03 Oct 2007) | 1 line
enumerate() is no longer bounded to using sequences shorter than LONG_MAX. The possibility of overflow was sending some newsgroup posters into a tizzy.
........
r58305 | raymond.hettinger | 2007-10-03 17:20:27 -0700 (Wed, 03 Oct 2007) | 1 line
itertools.count() no longer limited to sys.maxint.
........
r58306 | kurt.kaiser | 2007-10-03 18:49:54 -0700 (Wed, 03 Oct 2007) | 3 lines
Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
........
r58307 | kurt.kaiser | 2007-10-03 19:07:50 -0700 (Wed, 03 Oct 2007) | 2 lines
Remove unused theme that was causing a fault in p3k.
........
r58308 | kurt.kaiser | 2007-10-03 19:09:17 -0700 (Wed, 03 Oct 2007) | 2 lines
Clean up EditorWindow close.
........
r58309 | kurt.kaiser | 2007-10-03 19:53:07 -0700 (Wed, 03 Oct 2007) | 7 lines
textView cleanup. Patch 1718043 Tal Einat.
M idlelib/EditorWindow.py
M idlelib/aboutDialog.py
M idlelib/textView.py
M idlelib/NEWS.txt
........
r58310 | kurt.kaiser | 2007-10-03 20:11:12 -0700 (Wed, 03 Oct 2007) | 3 lines
configDialog cleanup. Patch 1730217 Tal Einat.
........
r58311 | neal.norwitz | 2007-10-03 23:00:48 -0700 (Wed, 03 Oct 2007) | 4 lines
Coverity #151: Remove deadcode.
All this code already exists above starting at line 653.
........
r58325 | fred.drake | 2007-10-04 19:46:12 -0700 (Thu, 04 Oct 2007) | 1 line
wrap lines to <80 characters before fixing errors
........
r58326 | raymond.hettinger | 2007-10-04 19:47:07 -0700 (Thu, 04 Oct 2007) | 6 lines
Add __asdict__() to NamedTuple and refine the docs.
Add maxlen support to deque() and fixup docs.
Partially fix __reduce__(). The None as a third arg was no longer supported.
Still needs work on __reduce__() to handle recursive inputs.
........
r58327 | fred.drake | 2007-10-04 19:48:32 -0700 (Thu, 04 Oct 2007) | 3 lines
move descriptions of ac_(in|out)_buffer_size to the right place
http://bugs.python.org/issue1053
........
r58329 | neal.norwitz | 2007-10-04 20:39:17 -0700 (Thu, 04 Oct 2007) | 3 lines
dict could be NULL, so we need to XDECREF.
Fix a compiler warning about passing a PyTypeObject* instead of PyObject*.
........
r58330 | neal.norwitz | 2007-10-04 20:41:19 -0700 (Thu, 04 Oct 2007) | 2 lines
Fix Coverity #158: Check the correct variable.
........
r58332 | neal.norwitz | 2007-10-04 22:01:38 -0700 (Thu, 04 Oct 2007) | 7 lines
Fix Coverity #159.
This code was broken if save() returned a negative number since i contained
a boolean value and then we compared i < 0 which should never be true.
Will backport (assuming it's necessary)
........
r58334 | neal.norwitz | 2007-10-04 22:29:17 -0700 (Thu, 04 Oct 2007) | 1 line
Add a note about fixing some more warnings found by Coverity.
........
r58338 | raymond.hettinger | 2007-10-05 12:07:31 -0700 (Fri, 05 Oct 2007) | 1 line
Restore BEGIN/END THREADS macros which were squashed in the previous checkin
........
r58343 | gregory.p.smith | 2007-10-06 00:48:10 -0700 (Sat, 06 Oct 2007) | 3 lines
Stab in the dark attempt to fix the test_bsddb3 failure on sparc and S-390
ubuntu buildbots.
........
r58344 | gregory.p.smith | 2007-10-06 00:51:59 -0700 (Sat, 06 Oct 2007) | 2 lines
Allows BerkeleyDB 4.6.x >= 4.6.21 for the bsddb module.
........
r58348 | gregory.p.smith | 2007-10-06 08:47:37 -0700 (Sat, 06 Oct 2007) | 3 lines
Use the host the author likely meant in the first place. pop.gmail.com is
reliable. gmail.org is someones personal domain.
........
r58351 | neal.norwitz | 2007-10-06 12:16:28 -0700 (Sat, 06 Oct 2007) | 3 lines
Ensure that this test will pass even if another test left an unwritable TESTFN.
Also use the safe unlink in test_support instead of rolling our own here.
........
r58368 | georg.brandl | 2007-10-08 00:50:24 -0700 (Mon, 08 Oct 2007) | 3 lines
#1123: fix the docs for the str.split(None, sep) case.
Also expand a few other methods' docs, which had more info in the deprecated string module docs.
........
r58369 | georg.brandl | 2007-10-08 01:06:05 -0700 (Mon, 08 Oct 2007) | 2 lines
Update docstring of sched, also remove an unused assignment.
........
r58370 | raymond.hettinger | 2007-10-08 02:14:28 -0700 (Mon, 08 Oct 2007) | 5 lines
Add comments to NamedTuple code.
Let the field spec be either a string or a non-string sequence (suggested by Martin Blais with use cases).
Improve the error message in the case of a SyntaxError (caused by a duplicate field name).
........
r58371 | raymond.hettinger | 2007-10-08 02:56:29 -0700 (Mon, 08 Oct 2007) | 1 line
Missed a line in the docs
........
r58372 | raymond.hettinger | 2007-10-08 03:11:51 -0700 (Mon, 08 Oct 2007) | 1 line
Better variable names
........
r58376 | georg.brandl | 2007-10-08 07:12:47 -0700 (Mon, 08 Oct 2007) | 3 lines
#1199: docs for tp_as_{number,sequence,mapping}, by Amaury Forgeot d'Arc.
No need to merge this to py3k!
........
r58380 | raymond.hettinger | 2007-10-08 14:26:58 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58381 | andrew.kuchling | 2007-10-08 16:23:03 -0700 (Mon, 08 Oct 2007) | 1 line
Eliminate camelcase function name
........
r58382 | raymond.hettinger | 2007-10-08 18:36:23 -0700 (Mon, 08 Oct 2007) | 1 line
Make the error messages more specific
........
r58384 | gregory.p.smith | 2007-10-08 23:02:21 -0700 (Mon, 08 Oct 2007) | 10 lines
Splits Modules/_bsddb.c up into bsddb.h and _bsddb.c and adds a C API
object available as bsddb.db.api. This is based on the patch submitted
by Duncan Grisby here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1551895&group_id=13900&atid=313900
See this thread for additional info:
http://sourceforge.net/mailarchive/forum.php?thread_name=E1GAVDK-0002rk-Iw%40apasphere.com&forum_name=pybsddb-users
It also cleans up the code a little by removing some ifdef/endifs for
python prior to 2.1 and for unsupported Berkeley DB <= 3.2.
........
r58385 | gregory.p.smith | 2007-10-08 23:50:43 -0700 (Mon, 08 Oct 2007) | 5 lines
Fix a double free when positioning a database cursor to a non-existant
string key (and probably a few other situations with string keys).
This was reported with a patch as pybsddb sourceforge bug 1708868 by
jjjhhhlll at gmail.
........
r58386 | gregory.p.smith | 2007-10-09 00:19:11 -0700 (Tue, 09 Oct 2007) | 3 lines
Use the highest cPickle protocol in bsddb.dbshelve. This comes from
sourceforge pybsddb patch 1551443 by w_barnes.
........
r58394 | gregory.p.smith | 2007-10-09 11:26:02 -0700 (Tue, 09 Oct 2007) | 2 lines
remove another sleepycat reference
........
r58396 | kurt.kaiser | 2007-10-09 12:31:30 -0700 (Tue, 09 Oct 2007) | 3 lines
Allow interrupt only when executing user code in subprocess
Patch 1225 Tal Einat modified from IDLE-Spoon.
........
r58399 | brett.cannon | 2007-10-09 17:07:50 -0700 (Tue, 09 Oct 2007) | 5 lines
Remove file-level typedefs that were inconsistently used throughout the file.
Just move over to the public API names.
Closes issue1238.
........
r58401 | raymond.hettinger | 2007-10-09 17:26:46 -0700 (Tue, 09 Oct 2007) | 1 line
Accept Jim Jewett's api suggestion to use None instead of -1 to indicate unbounded deques.
........
r58403 | kurt.kaiser | 2007-10-09 17:55:40 -0700 (Tue, 09 Oct 2007) | 2 lines
Allow cursor color change w/o restart. Patch 1725576 Tal Einat.
........
r58404 | kurt.kaiser | 2007-10-09 18:06:47 -0700 (Tue, 09 Oct 2007) | 2 lines
show paste if > 80 columns. Patch 1659326 Tal Einat.
........
r58415 | thomas.heller | 2007-10-11 12:51:32 -0700 (Thu, 11 Oct 2007) | 5 lines
On OS X, use os.uname() instead of gestalt.sysv(...) to get the
operating system version. This allows to use ctypes when Python
was configured with --disable-toolbox-glue.
........
r58419 | neal.norwitz | 2007-10-11 20:01:01 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warning about not being able to create an existing directory.
........
r58420 | neal.norwitz | 2007-10-11 20:01:30 -0700 (Thu, 11 Oct 2007) | 1 line
Get rid of warnings on a bunch of platforms by using a proper prototype.
........
r58421 | neal.norwitz | 2007-10-11 20:01:54 -0700 (Thu, 11 Oct 2007) | 4 lines
Get rid of compiler warning about retval being used (returned) without
being initialized. (gcc warning and Coverity 202)
........
r58422 | neal.norwitz | 2007-10-11 20:03:23 -0700 (Thu, 11 Oct 2007) | 1 line
Fix Coverity 168: Close the file before returning (exiting).
........
r58423 | neal.norwitz | 2007-10-11 20:04:18 -0700 (Thu, 11 Oct 2007) | 4 lines
Fix Coverity 180: Don't overallocate. We don't need structs, but pointers.
Also fix a memory leak.
........
r58424 | neal.norwitz | 2007-10-11 20:05:19 -0700 (Thu, 11 Oct 2007) | 5 lines
Fix Coverity 185-186: If the passed in FILE is NULL, uninitialized memory
would be accessed.
Will backport.
........
r58425 | neal.norwitz | 2007-10-11 20:52:34 -0700 (Thu, 11 Oct 2007) | 1 line
Get this module to compile with bsddb versions prior to 4.3
........
r58430 | martin.v.loewis | 2007-10-12 01:56:52 -0700 (Fri, 12 Oct 2007) | 3 lines
Bug #1216: Restore support for Visual Studio 2002.
Will backport to 2.5.
........
r58433 | raymond.hettinger | 2007-10-12 10:53:11 -0700 (Fri, 12 Oct 2007) | 1 line
Fix test of count.__repr__() to ignore the 'L' if the count is a long
........
r58434 | gregory.p.smith | 2007-10-12 11:44:06 -0700 (Fri, 12 Oct 2007) | 4 lines
Fixes http://bugs.python.org/issue1233 - bsddb.dbshelve.DBShelf.append
was useless due to inverted logic. Also adds a test case for RECNO dbs
to test_dbshelve.
........
r58445 | georg.brandl | 2007-10-13 06:20:03 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix email example.
........
r58450 | gregory.p.smith | 2007-10-13 16:02:05 -0700 (Sat, 13 Oct 2007) | 2 lines
Fix an uncollectable reference leak in bsddb.db.DBShelf.append
........
r58453 | neal.norwitz | 2007-10-13 17:18:40 -0700 (Sat, 13 Oct 2007) | 8 lines
Let the O/S supply a port if none of the default ports can be used.
This should make the tests more robust at the expense of allowing
tests to be sloppier by not requiring them to cleanup after themselves.
(It will legitamitely help when running two test suites simultaneously
or if another process is already using one of the predefined ports.)
Also simplifies (slightLy) the exception handling elsewhere.
........
r58459 | neal.norwitz | 2007-10-14 11:30:21 -0700 (Sun, 14 Oct 2007) | 2 lines
Don't raise a string exception, they don't work anymore.
........
r58460 | neal.norwitz | 2007-10-14 11:40:37 -0700 (Sun, 14 Oct 2007) | 1 line
Use unittest for assertions
........
r58468 | armin.rigo | 2007-10-15 00:48:35 -0700 (Mon, 15 Oct 2007) | 2 lines
test_bigbits was not testing what it seemed to.
........
r58471 | guido.van.rossum | 2007-10-15 08:54:11 -0700 (Mon, 15 Oct 2007) | 3 lines
Change a PyErr_Print() into a PyErr_Clear(),
per discussion in issue 1031213.
........
r58500 | raymond.hettinger | 2007-10-16 12:18:30 -0700 (Tue, 16 Oct 2007) | 1 line
Improve error messages
........
r58506 | raymond.hettinger | 2007-10-16 14:28:32 -0700 (Tue, 16 Oct 2007) | 1 line
More docs, error messages, and tests
........
r58507 | andrew.kuchling | 2007-10-16 15:58:03 -0700 (Tue, 16 Oct 2007) | 1 line
Add items
........
r58508 | brett.cannon | 2007-10-16 16:24:06 -0700 (Tue, 16 Oct 2007) | 3 lines
Remove ``:const:`` notation on None in parameter list. Since the markup is not
rendered for parameters it just showed up as ``:const:`None` `` in the output.
........
r58509 | brett.cannon | 2007-10-16 16:26:45 -0700 (Tue, 16 Oct 2007) | 3 lines
Re-order some functions whose parameters differ between PyObject and const char
* so that they are next to each other.
........
r58522 | armin.rigo | 2007-10-17 11:46:37 -0700 (Wed, 17 Oct 2007) | 5 lines
Fix the overflow checking of list_repeat.
Introduce overflow checking into list_inplace_repeat.
Backport candidate, possibly.
........
r58530 | facundo.batista | 2007-10-17 20:16:03 -0700 (Wed, 17 Oct 2007) | 7 lines
Issue #1580738. When HTTPConnection reads the whole stream with read(),
it closes itself. When the stream is read in several calls to read(n),
it should behave in the same way if HTTPConnection knows where the end
of the stream is (through self.length). Added a test case for this
behaviour.
........
r58531 | facundo.batista | 2007-10-17 20:44:48 -0700 (Wed, 17 Oct 2007) | 3 lines
Issue 1289, just a typo.
........
r58532 | gregory.p.smith | 2007-10-18 00:56:54 -0700 (Thu, 18 Oct 2007) | 4 lines
cleanup test_dbtables to use mkdtemp. cleanup dbtables to pass txn as a
keyword argument whenever possible to avoid bugs and confusion. (dbtables.py
line 447 self.db.get using txn as a non-keyword was an actual bug due to this)
........
r58533 | gregory.p.smith | 2007-10-18 01:34:20 -0700 (Thu, 18 Oct 2007) | 4 lines
Fix a weird bug in dbtables: if it chose a random rowid string that contained
NULL bytes it would cause the database all sorts of problems in the future
leading to very strange random failures and corrupt dbtables.bsdTableDb dbs.
........
r58534 | gregory.p.smith | 2007-10-18 09:32:02 -0700 (Thu, 18 Oct 2007) | 3 lines
A cleaner fix than the one committed last night. Generate random rowids that
do not contain null bytes.
........
r58537 | gregory.p.smith | 2007-10-18 10:17:57 -0700 (Thu, 18 Oct 2007) | 2 lines
mention bsddb fixes.
........
r58538 | raymond.hettinger | 2007-10-18 14:13:06 -0700 (Thu, 18 Oct 2007) | 1 line
Remove useless warning
........
r58539 | gregory.p.smith | 2007-10-19 00:31:20 -0700 (Fri, 19 Oct 2007) | 2 lines
squelch the warning that this test is supposed to trigger.
........
r58542 | georg.brandl | 2007-10-19 05:32:39 -0700 (Fri, 19 Oct 2007) | 2 lines
Clarify wording for apply().
........
r58544 | mark.summerfield | 2007-10-19 05:48:17 -0700 (Fri, 19 Oct 2007) | 3 lines
Added a cross-ref to each other.
........
r58545 | georg.brandl | 2007-10-19 10:38:49 -0700 (Fri, 19 Oct 2007) | 2 lines
#1284: "S" means "seen", not unread.
........
r58548 | thomas.heller | 2007-10-19 11:11:41 -0700 (Fri, 19 Oct 2007) | 4 lines
Fix ctypes on 32-bit systems when Python is configured --with-system-ffi.
See also https://bugs.launchpad.net/bugs/72505.
Ported from release25-maint branch.
........
r58550 | facundo.batista | 2007-10-19 12:25:57 -0700 (Fri, 19 Oct 2007) | 8 lines
The constructor from tuple was way too permissive: it allowed bad
coefficient numbers, floats in the sign, and other details that
generated directly the wrong number in the best case, or triggered
misfunctionality in the alorithms.
Test cases added for these issues. Thanks Mark Dickinson.
........
r58559 | georg.brandl | 2007-10-20 06:22:53 -0700 (Sat, 20 Oct 2007) | 2 lines
Fix code being interpreted as a target.
........
r58561 | georg.brandl | 2007-10-20 06:36:24 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new "cmdoption" directive.
........
r58562 | georg.brandl | 2007-10-20 08:21:22 -0700 (Sat, 20 Oct 2007) | 2 lines
Make a path more Unix-standardy.
........
r58564 | georg.brandl | 2007-10-20 10:51:39 -0700 (Sat, 20 Oct 2007) | 2 lines
Document new directive "envvar".
........
r58567 | georg.brandl | 2007-10-20 11:08:14 -0700 (Sat, 20 Oct 2007) | 6 lines
* Add new toplevel chapter, "Using Python." (how to install,
configure and setup python on different platforms -- at least
in theory.)
* Move the Python on Mac docs in that chapter.
* Add a new chapter about the command line invocation, by stargaming.
........
r58568 | georg.brandl | 2007-10-20 11:33:20 -0700 (Sat, 20 Oct 2007) | 2 lines
Change title, for now.
........
r58569 | georg.brandl | 2007-10-20 11:39:25 -0700 (Sat, 20 Oct 2007) | 2 lines
Add entry to ACKS.
........
r58570 | georg.brandl | 2007-10-20 12:05:45 -0700 (Sat, 20 Oct 2007) | 2 lines
Clarify -E docs.
........
r58571 | georg.brandl | 2007-10-20 12:08:36 -0700 (Sat, 20 Oct 2007) | 2 lines
Even more clarification.
........
r58572 | andrew.kuchling | 2007-10-20 12:25:37 -0700 (Sat, 20 Oct 2007) | 1 line
Fix protocol name
........
r58573 | andrew.kuchling | 2007-10-20 12:35:18 -0700 (Sat, 20 Oct 2007) | 1 line
Various items
........
r58574 | andrew.kuchling | 2007-10-20 12:39:35 -0700 (Sat, 20 Oct 2007) | 1 line
Use correct header line
........
r58576 | armin.rigo | 2007-10-21 02:14:15 -0700 (Sun, 21 Oct 2007) | 3 lines
Add a crasher for the long-standing issue with closing a file
while another thread uses it.
........
r58577 | georg.brandl | 2007-10-21 03:01:56 -0700 (Sun, 21 Oct 2007) | 2 lines
Remove duplicate crasher.
........
r58578 | georg.brandl | 2007-10-21 03:24:20 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "byte code" to "bytecode". Also sprinkle :term: markup for it.
........
r58579 | georg.brandl | 2007-10-21 03:32:54 -0700 (Sun, 21 Oct 2007) | 2 lines
Add markup to new function descriptions.
........
r58580 | georg.brandl | 2007-10-21 03:45:46 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for descriptors.
........
r58581 | georg.brandl | 2007-10-21 03:46:24 -0700 (Sun, 21 Oct 2007) | 2 lines
Unify "file-descriptor" to "file descriptor".
........
r58582 | georg.brandl | 2007-10-21 03:52:38 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term: for generators.
........
r58583 | georg.brandl | 2007-10-21 05:10:28 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for iterator.
........
r58584 | georg.brandl | 2007-10-21 05:15:05 -0700 (Sun, 21 Oct 2007) | 2 lines
Add :term:s for "new-style class".
........
r58588 | neal.norwitz | 2007-10-21 21:47:54 -0700 (Sun, 21 Oct 2007) | 1 line
Add Chris Monson so he can edit PEPs.
........
r58594 | guido.van.rossum | 2007-10-22 09:27:19 -0700 (Mon, 22 Oct 2007) | 4 lines
Issue #1307, patch by Derek Shockey.
When "MAIL" is received without args, an exception happens instead of
sending a 501 syntax error response.
........
r58598 | travis.oliphant | 2007-10-22 19:40:56 -0700 (Mon, 22 Oct 2007) | 1 line
Add phuang patch from Issue 708374 which adds offset parameter to mmap module.
........
r58601 | neal.norwitz | 2007-10-22 22:44:27 -0700 (Mon, 22 Oct 2007) | 2 lines
Bug #1313, fix typo (wrong variable name) in example.
........
r58609 | georg.brandl | 2007-10-23 11:21:35 -0700 (Tue, 23 Oct 2007) | 2 lines
Update Pygments version from externals.
........
r58618 | guido.van.rossum | 2007-10-23 12:25:41 -0700 (Tue, 23 Oct 2007) | 3 lines
Issue 1307 by Derek Shockey, fox the same bug for RCPT.
Neal: please backport!
........
r58620 | raymond.hettinger | 2007-10-23 13:37:41 -0700 (Tue, 23 Oct 2007) | 1 line
Shorter name for namedtuple()
........
r58621 | andrew.kuchling | 2007-10-23 13:55:47 -0700 (Tue, 23 Oct 2007) | 1 line
Update name
........
r58622 | raymond.hettinger | 2007-10-23 14:23:07 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup news entry
........
r58623 | raymond.hettinger | 2007-10-23 18:28:33 -0700 (Tue, 23 Oct 2007) | 1 line
Optimize sum() for integer and float inputs.
........
r58624 | raymond.hettinger | 2007-10-23 19:05:51 -0700 (Tue, 23 Oct 2007) | 1 line
Fixup error return and add support for intermixed ints and floats/
........
r58628 | vinay.sajip | 2007-10-24 03:47:06 -0700 (Wed, 24 Oct 2007) | 1 line
Bug #1321: Fixed logic error in TimedRotatingFileHandler.__init__()
........
r58641 | facundo.batista | 2007-10-24 12:11:08 -0700 (Wed, 24 Oct 2007) | 4 lines
Issue 1290. CharacterData.__repr__ was constructing a string
in response that keeped having a non-ascii character.
........
r58643 | thomas.heller | 2007-10-24 12:50:45 -0700 (Wed, 24 Oct 2007) | 1 line
Added unittest for calling a function with paramflags (backport from py3k branch).
........
r58645 | matthias.klose | 2007-10-24 13:00:44 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*.
........
r58651 | georg.brandl | 2007-10-24 14:40:38 -0700 (Wed, 24 Oct 2007) | 2 lines
Bug #1287: make os.environ.pop() work as expected.
........
r58652 | raymond.hettinger | 2007-10-24 19:26:58 -0700 (Wed, 24 Oct 2007) | 1 line
Missing DECREFs
........
r58653 | matthias.klose | 2007-10-24 23:37:24 -0700 (Wed, 24 Oct 2007) | 2 lines
- Build using system ffi library on arm*-linux*, pass --with-system-ffi to CONFIG_ARGS
........
r58655 | thomas.heller | 2007-10-25 12:47:32 -0700 (Thu, 25 Oct 2007) | 2 lines
ffi_type_longdouble may be already #defined.
See issue 1324.
........
r58656 | kurt.kaiser | 2007-10-25 15:43:45 -0700 (Thu, 25 Oct 2007) | 3 lines
Correct an ancient bug in an unused path by removing that path: register() is
now idempotent.
........
r58660 | kurt.kaiser | 2007-10-25 17:10:09 -0700 (Thu, 25 Oct 2007) | 4 lines
1. Add comments to provide top-level documentation.
2. Refactor to use more descriptive names.
3. Enhance tests in main().
........
r58675 | georg.brandl | 2007-10-26 11:30:41 -0700 (Fri, 26 Oct 2007) | 2 lines
Fix new pop() method on os.environ on ignorecase-platforms.
........
r58696 | neal.norwitz | 2007-10-27 15:32:21 -0700 (Sat, 27 Oct 2007) | 1 line
Update URL for Pygments. 0.8.1 is no longer available
........
r58697 | hyeshik.chang | 2007-10-28 04:19:02 -0700 (Sun, 28 Oct 2007) | 3 lines
- Add support for FreeBSD 8 which is recently forked from FreeBSD 7.
- Regenerate IN module for most recent maintenance tree of FreeBSD 6 and 7.
........
r58698 | hyeshik.chang | 2007-10-28 05:38:09 -0700 (Sun, 28 Oct 2007) | 2 lines
Enable platform-specific tweaks for FreeBSD 8 (exactly same to FreeBSD 7's yet)
........
r58700 | kurt.kaiser | 2007-10-28 12:03:59 -0700 (Sun, 28 Oct 2007) | 2 lines
Add confirmation dialog before printing. Patch 1717170 Tal Einat.
........
r58706 | guido.van.rossum | 2007-10-29 13:52:45 -0700 (Mon, 29 Oct 2007) | 3 lines
Patch 1353 by Jacob Winther.
Add mp4 mapping to mimetypes.py.
........
r58709 | guido.van.rossum | 2007-10-29 15:15:05 -0700 (Mon, 29 Oct 2007) | 6 lines
Backport fixes for the code that decodes octal escapes (and for PyString
also hex escapes) -- this was reaching beyond the end of the input string
buffer, even though it is not supposed to be \0-terminated.
This has no visible effect but is clearly the correct thing to do.
(In 3.0 it had a visible effect after removing ob_sstate from PyString.)
........
r58710 | kurt.kaiser | 2007-10-29 19:38:54 -0700 (Mon, 29 Oct 2007) | 7 lines
check in Tal Einat's update to tabpage.py
Patch 1612746
M configDialog.py
M NEWS.txt
AM tabbedpages.py
........
r58715 | georg.brandl | 2007-10-30 10:51:18 -0700 (Tue, 30 Oct 2007) | 2 lines
Use correct markup.
........
r58716 | georg.brandl | 2007-10-30 10:57:12 -0700 (Tue, 30 Oct 2007) | 2 lines
Make example about hiding None return values at the prompt clearer.
........
r58728 | neal.norwitz | 2007-10-30 23:33:20 -0700 (Tue, 30 Oct 2007) | 1 line
Fix some compiler warnings for signed comparisons on Unix and Windows.
........
r58731 | martin.v.loewis | 2007-10-31 10:19:33 -0700 (Wed, 31 Oct 2007) | 2 lines
Adding Christian Heimes.
........
r58737 | raymond.hettinger | 2007-10-31 14:57:58 -0700 (Wed, 31 Oct 2007) | 1 line
Clarify the reasons why pickle is almost always better than marshal
........
r58739 | raymond.hettinger | 2007-10-31 15:15:49 -0700 (Wed, 31 Oct 2007) | 1 line
Sets are marshalable.
........
2007-11-01 17:32:30 -03:00
|
|
|
d = { 'clientip' : '192.168.0.1', 'user' : 'fbloggs' }
|
2007-08-15 11:28:22 -03:00
|
|
|
logger = logging.getLogger("tcpserver")
|
|
|
|
logger.warning("Protocol problem: %s", "connection reset", extra=d)
|
|
|
|
|
|
|
|
would print something like ::
|
|
|
|
|
|
|
|
2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset
|
|
|
|
|
|
|
|
The keys in the dictionary passed in *extra* should not clash with the keys used
|
|
|
|
by the logging system. (See the :class:`Formatter` documentation for more
|
|
|
|
information on which keys are used by the logging system.)
|
|
|
|
|
|
|
|
If you choose to use these attributes in logged messages, you need to exercise
|
|
|
|
some care. In the above example, for instance, the :class:`Formatter` has been
|
|
|
|
set up with a format string which expects 'clientip' and 'user' in the attribute
|
|
|
|
dictionary of the LogRecord. If these are missing, the message will not be
|
|
|
|
logged because a string formatting exception will occur. So in this case, you
|
|
|
|
always need to pass the *extra* dictionary with these keys.
|
|
|
|
|
|
|
|
While this might be annoying, this feature is intended for use in specialized
|
|
|
|
circumstances, such as multi-threaded servers where the same code executes in
|
|
|
|
many contexts, and interesting conditions which arise are dependent on this
|
|
|
|
context (such as remote client IP address and authenticated user name, in the
|
|
|
|
above example). In such circumstances, it is likely that specialized
|
|
|
|
:class:`Formatter`\ s would be used with particular :class:`Handler`\ s.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.info(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`INFO` on this logger. The arguments are
|
|
|
|
interpreted as for :meth:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.warning(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`WARNING` on this logger. The arguments are
|
|
|
|
interpreted as for :meth:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.error(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`ERROR` on this logger. The arguments are
|
|
|
|
interpreted as for :meth:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.critical(msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`CRITICAL` on this logger. The arguments are
|
|
|
|
interpreted as for :meth:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.log(lvl, msg, *args, **kwargs)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with integer level *lvl* on this logger. The other arguments are
|
|
|
|
interpreted as for :meth:`debug`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.exception(msg, *args)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Logs a message with level :const:`ERROR` on this logger. The arguments are
|
|
|
|
interpreted as for :meth:`debug`. Exception info is added to the logging
|
|
|
|
message. This method should only be called from an exception handler.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.addFilter(filt)
|
|
|
|
|
|
|
|
Adds the specified filter *filt* to this logger.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.removeFilter(filt)
|
|
|
|
|
|
|
|
Removes the specified filter *filt* from this logger.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.filter(record)
|
|
|
|
|
|
|
|
Applies this logger's filters to the record and returns a true value if the
|
|
|
|
record is to be processed.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.addHandler(hdlr)
|
|
|
|
|
|
|
|
Adds the specified handler *hdlr* to this logger.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.removeHandler(hdlr)
|
|
|
|
|
|
|
|
Removes the specified handler *hdlr* from this logger.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.findCaller()
|
|
|
|
|
|
|
|
Finds the caller's source filename and line number. Returns the filename, line
|
|
|
|
number and function name as a 3-element tuple.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Logger.handle(record)
|
|
|
|
|
|
|
|
Handles a record by passing it to all handlers associated with this logger and
|
|
|
|
its ancestors (until a false value of *propagate* is found). This method is used
|
|
|
|
for unpickled records received from a socket, as well as those created locally.
|
2009-07-26 12:02:41 -03:00
|
|
|
Logger-level filtering is applied using :meth:`~Logger.filter`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: Logger.makeRecord(name, lvl, fn, lno, msg, args, exc_info, func=None, extra=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
This is a factory method which can be overridden in subclasses to create
|
|
|
|
specialized :class:`LogRecord` instances.
|
|
|
|
|
|
|
|
|
|
|
|
.. _minimal-example:
|
|
|
|
|
|
|
|
Basic example
|
|
|
|
-------------
|
|
|
|
|
|
|
|
The :mod:`logging` package provides a lot of flexibility, and its configuration
|
|
|
|
can appear daunting. This section demonstrates that simple use of the logging
|
|
|
|
package is possible.
|
|
|
|
|
|
|
|
The simplest example shows logging to the console::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.debug('A debug message')
|
|
|
|
logging.info('Some information')
|
|
|
|
logging.warning('A shot across the bows')
|
|
|
|
|
|
|
|
If you run the above script, you'll see this::
|
|
|
|
|
|
|
|
WARNING:root:A shot across the bows
|
|
|
|
|
|
|
|
Because no particular logger was specified, the system used the root logger. The
|
|
|
|
debug and info messages didn't appear because by default, the root logger is
|
|
|
|
configured to only handle messages with a severity of WARNING or above. The
|
|
|
|
message format is also a configuration default, as is the output destination of
|
|
|
|
the messages - ``sys.stderr``. The severity level, the message format and
|
|
|
|
destination can be easily changed, as shown in the example below::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format='%(asctime)s %(levelname)s %(message)s',
|
|
|
|
filename='/tmp/myapp.log',
|
|
|
|
filemode='w')
|
|
|
|
logging.debug('A debug message')
|
|
|
|
logging.info('Some information')
|
|
|
|
logging.warning('A shot across the bows')
|
|
|
|
|
|
|
|
The :meth:`basicConfig` method is used to change the configuration defaults,
|
|
|
|
which results in output (written to ``/tmp/myapp.log``) which should look
|
|
|
|
something like the following::
|
|
|
|
|
|
|
|
2004-07-02 13:00:08,743 DEBUG A debug message
|
|
|
|
2004-07-02 13:00:08,743 INFO Some information
|
|
|
|
2004-07-02 13:00:08,743 WARNING A shot across the bows
|
|
|
|
|
|
|
|
This time, all messages with a severity of DEBUG or above were handled, and the
|
|
|
|
format of the messages was also changed, and output went to the specified file
|
|
|
|
rather than the console.
|
|
|
|
|
2007-08-31 14:17:17 -03:00
|
|
|
.. XXX logging should probably be updated for new string formatting!
|
2007-08-31 06:22:56 -03:00
|
|
|
|
|
|
|
Formatting uses the old Python string formatting - see section
|
|
|
|
:ref:`old-string-formatting`. The format string takes the following common
|
2007-08-15 11:28:22 -03:00
|
|
|
specifiers. For a complete list of specifiers, consult the :class:`Formatter`
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
+-------------------+-----------------------------------------------+
|
|
|
|
| Format | Description |
|
|
|
|
+===================+===============================================+
|
|
|
|
| ``%(name)s`` | Name of the logger (logging channel). |
|
|
|
|
+-------------------+-----------------------------------------------+
|
|
|
|
| ``%(levelname)s`` | Text logging level for the message |
|
|
|
|
| | (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, |
|
|
|
|
| | ``'ERROR'``, ``'CRITICAL'``). |
|
|
|
|
+-------------------+-----------------------------------------------+
|
|
|
|
| ``%(asctime)s`` | Human-readable time when the |
|
|
|
|
| | :class:`LogRecord` was created. By default |
|
|
|
|
| | this is of the form "2003-07-08 16:49:45,896" |
|
|
|
|
| | (the numbers after the comma are millisecond |
|
|
|
|
| | portion of the time). |
|
|
|
|
+-------------------+-----------------------------------------------+
|
|
|
|
| ``%(message)s`` | The logged message. |
|
|
|
|
+-------------------+-----------------------------------------------+
|
|
|
|
|
|
|
|
To change the date/time format, you can pass an additional keyword parameter,
|
|
|
|
*datefmt*, as in the following::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format='%(asctime)s %(levelname)-8s %(message)s',
|
|
|
|
datefmt='%a, %d %b %Y %H:%M:%S',
|
|
|
|
filename='/temp/myapp.log',
|
|
|
|
filemode='w')
|
|
|
|
logging.debug('A debug message')
|
|
|
|
logging.info('Some information')
|
|
|
|
logging.warning('A shot across the bows')
|
|
|
|
|
|
|
|
which would result in output like ::
|
|
|
|
|
|
|
|
Fri, 02 Jul 2004 13:06:18 DEBUG A debug message
|
|
|
|
Fri, 02 Jul 2004 13:06:18 INFO Some information
|
|
|
|
Fri, 02 Jul 2004 13:06:18 WARNING A shot across the bows
|
|
|
|
|
|
|
|
The date format string follows the requirements of :func:`strftime` - see the
|
|
|
|
documentation for the :mod:`time` module.
|
|
|
|
|
|
|
|
If, instead of sending logging output to the console or a file, you'd rather use
|
|
|
|
a file-like object which you have created separately, you can pass it to
|
|
|
|
:func:`basicConfig` using the *stream* keyword argument. Note that if both
|
|
|
|
*stream* and *filename* keyword arguments are passed, the *stream* argument is
|
|
|
|
ignored.
|
|
|
|
|
|
|
|
Of course, you can put variable information in your output. To do this, simply
|
|
|
|
have the message be a format string and pass in additional arguments containing
|
|
|
|
the variable information, as in the following example::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format='%(asctime)s %(levelname)-8s %(message)s',
|
|
|
|
datefmt='%a, %d %b %Y %H:%M:%S',
|
|
|
|
filename='/temp/myapp.log',
|
|
|
|
filemode='w')
|
|
|
|
logging.error('Pack my box with %d dozen %s', 5, 'liquor jugs')
|
|
|
|
|
|
|
|
which would result in ::
|
|
|
|
|
|
|
|
Wed, 21 Jul 2004 15:35:16 ERROR Pack my box with 5 dozen liquor jugs
|
|
|
|
|
|
|
|
|
|
|
|
.. _multiple-destinations:
|
|
|
|
|
|
|
|
Logging to multiple destinations
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
Let's say you want to log to console and file with different message formats and
|
|
|
|
in differing circumstances. Say you want to log messages with levels of DEBUG
|
|
|
|
and higher to file, and those messages at level INFO and higher to the console.
|
|
|
|
Let's also assume that the file should contain timestamps, but the console
|
|
|
|
messages should not. Here's how you can achieve this::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
# set up logging to file - see previous section for more details
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
|
|
|
|
datefmt='%m-%d %H:%M',
|
|
|
|
filename='/temp/myapp.log',
|
|
|
|
filemode='w')
|
|
|
|
# define a Handler which writes INFO messages or higher to the sys.stderr
|
|
|
|
console = logging.StreamHandler()
|
|
|
|
console.setLevel(logging.INFO)
|
|
|
|
# set a format which is simpler for console use
|
|
|
|
formatter = logging.Formatter('%(name)-12s: %(levelname)-8s %(message)s')
|
|
|
|
# tell the handler to use this format
|
|
|
|
console.setFormatter(formatter)
|
|
|
|
# add the handler to the root logger
|
|
|
|
logging.getLogger('').addHandler(console)
|
|
|
|
|
|
|
|
# Now, we can log to the root logger, or any other logger. First the root...
|
|
|
|
logging.info('Jackdaws love my big sphinx of quartz.')
|
|
|
|
|
|
|
|
# Now, define a couple of other loggers which might represent areas in your
|
|
|
|
# application:
|
|
|
|
|
|
|
|
logger1 = logging.getLogger('myapp.area1')
|
|
|
|
logger2 = logging.getLogger('myapp.area2')
|
|
|
|
|
|
|
|
logger1.debug('Quick zephyrs blow, vexing daft Jim.')
|
|
|
|
logger1.info('How quickly daft jumping zebras vex.')
|
|
|
|
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
|
|
|
|
logger2.error('The five boxing wizards jump quickly.')
|
|
|
|
|
|
|
|
When you run this, on the console you will see ::
|
|
|
|
|
|
|
|
root : INFO Jackdaws love my big sphinx of quartz.
|
|
|
|
myapp.area1 : INFO How quickly daft jumping zebras vex.
|
|
|
|
myapp.area2 : WARNING Jail zesty vixen who grabbed pay from quack.
|
|
|
|
myapp.area2 : ERROR The five boxing wizards jump quickly.
|
|
|
|
|
|
|
|
and in the file you will see something like ::
|
|
|
|
|
|
|
|
10-22 22:19 root INFO Jackdaws love my big sphinx of quartz.
|
|
|
|
10-22 22:19 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.
|
|
|
|
10-22 22:19 myapp.area1 INFO How quickly daft jumping zebras vex.
|
|
|
|
10-22 22:19 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.
|
|
|
|
10-22 22:19 myapp.area2 ERROR The five boxing wizards jump quickly.
|
|
|
|
|
|
|
|
As you can see, the DEBUG message only shows up in the file. The other messages
|
|
|
|
are sent to both destinations.
|
|
|
|
|
|
|
|
This example uses console and file handlers, but you can use any number and
|
|
|
|
combination of handlers you choose.
|
|
|
|
|
2009-08-20 19:05:10 -03:00
|
|
|
.. _logging-exceptions:
|
|
|
|
|
|
|
|
Exceptions raised during logging
|
|
|
|
--------------------------------
|
|
|
|
|
|
|
|
The logging package is designed to swallow exceptions which occur while logging
|
|
|
|
in production. This is so that errors which occur while handling logging events
|
|
|
|
- such as logging misconfiguration, network or other similar errors - do not
|
|
|
|
cause the application using logging to terminate prematurely.
|
|
|
|
|
|
|
|
:class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never
|
|
|
|
swallowed. Other exceptions which occur during the :meth:`emit` method of a
|
|
|
|
:class:`Handler` subclass are passed to its :meth:`handleError` method.
|
|
|
|
|
|
|
|
The default implementation of :meth:`handleError` in :class:`Handler` checks
|
2010-03-12 06:06:40 -04:00
|
|
|
to see if a module-level variable, :data:`raiseExceptions`, is set. If set, a
|
|
|
|
traceback is printed to :data:`sys.stderr`. If not set, the exception is swallowed.
|
2009-08-20 19:05:10 -03:00
|
|
|
|
2010-03-12 06:06:40 -04:00
|
|
|
**Note:** The default value of :data:`raiseExceptions` is ``True``. This is because
|
2009-08-20 19:05:10 -03:00
|
|
|
during development, you typically want to be notified of any exceptions that
|
2010-03-12 06:06:40 -04:00
|
|
|
occur. It's advised that you set :data:`raiseExceptions` to ``False`` for production
|
2009-08-20 19:05:10 -03:00
|
|
|
usage.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 59822-59841 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59822 | georg.brandl | 2008-01-07 17:43:47 +0100 (Mon, 07 Jan 2008) | 2 lines
Restore "somenamedtuple" as the "class" for named tuple attrs.
........
r59824 | georg.brandl | 2008-01-07 18:09:35 +0100 (Mon, 07 Jan 2008) | 2 lines
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
........
r59827 | georg.brandl | 2008-01-07 18:25:53 +0100 (Mon, 07 Jan 2008) | 2 lines
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
........
r59830 | georg.brandl | 2008-01-07 19:16:36 +0100 (Mon, 07 Jan 2008) | 2 lines
Make Python compile with --disable-unicode.
........
r59831 | georg.brandl | 2008-01-07 19:23:27 +0100 (Mon, 07 Jan 2008) | 2 lines
Restructure urllib doc structure.
........
r59833 | georg.brandl | 2008-01-07 19:41:34 +0100 (Mon, 07 Jan 2008) | 2 lines
Fix #define ordering.
........
r59834 | georg.brandl | 2008-01-07 19:47:44 +0100 (Mon, 07 Jan 2008) | 2 lines
#467924, patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall.
........
r59835 | raymond.hettinger | 2008-01-07 19:52:19 +0100 (Mon, 07 Jan 2008) | 1 line
Fix inconsistent title levels -- it made the whole doc build crash horribly.
........
r59836 | georg.brandl | 2008-01-07 19:57:03 +0100 (Mon, 07 Jan 2008) | 2 lines
Fix two further doc build warnings.
........
r59837 | georg.brandl | 2008-01-07 20:17:10 +0100 (Mon, 07 Jan 2008) | 2 lines
Clarify metaclass docs and add example.
........
r59838 | vinay.sajip | 2008-01-07 20:40:10 +0100 (Mon, 07 Jan 2008) | 1 line
Added section about adding contextual information to log output.
........
r59839 | christian.heimes | 2008-01-07 20:58:41 +0100 (Mon, 07 Jan 2008) | 1 line
Fixed indention problem that caused the second TIPC test to run on systems without TIPC
........
r59840 | raymond.hettinger | 2008-01-07 21:07:38 +0100 (Mon, 07 Jan 2008) | 1 line
Cleanup named tuple subclassing example.
........
2008-01-07 17:14:23 -04:00
|
|
|
.. _context-info:
|
|
|
|
|
|
|
|
Adding contextual information to your logging output
|
|
|
|
----------------------------------------------------
|
|
|
|
|
|
|
|
Sometimes you want logging output to contain contextual information in
|
|
|
|
addition to the parameters passed to the logging call. For example, in a
|
|
|
|
networked application, it may be desirable to log client-specific information
|
|
|
|
in the log (e.g. remote client's username, or IP address). Although you could
|
|
|
|
use the *extra* parameter to achieve this, it's not always convenient to pass
|
|
|
|
the information in this way. While it might be tempting to create
|
|
|
|
:class:`Logger` instances on a per-connection basis, this is not a good idea
|
|
|
|
because these instances are not garbage collected. While this is not a problem
|
|
|
|
in practice, when the number of :class:`Logger` instances is dependent on the
|
|
|
|
level of granularity you want to use in logging an application, it could
|
|
|
|
be hard to manage if the number of :class:`Logger` instances becomes
|
|
|
|
effectively unbounded.
|
|
|
|
|
2008-01-18 14:40:46 -04:00
|
|
|
An easy way in which you can pass contextual information to be output along
|
|
|
|
with logging event information is to use the :class:`LoggerAdapter` class.
|
|
|
|
This class is designed to look like a :class:`Logger`, so that you can call
|
|
|
|
:meth:`debug`, :meth:`info`, :meth:`warning`, :meth:`error`,
|
|
|
|
:meth:`exception`, :meth:`critical` and :meth:`log`. These methods have the
|
|
|
|
same signatures as their counterparts in :class:`Logger`, so you can use the
|
|
|
|
two types of instances interchangeably.
|
|
|
|
|
|
|
|
When you create an instance of :class:`LoggerAdapter`, you pass it a
|
|
|
|
:class:`Logger` instance and a dict-like object which contains your contextual
|
|
|
|
information. When you call one of the logging methods on an instance of
|
|
|
|
:class:`LoggerAdapter`, it delegates the call to the underlying instance of
|
|
|
|
:class:`Logger` passed to its constructor, and arranges to pass the contextual
|
|
|
|
information in the delegated call. Here's a snippet from the code of
|
|
|
|
:class:`LoggerAdapter`::
|
|
|
|
|
|
|
|
def debug(self, msg, *args, **kwargs):
|
|
|
|
"""
|
|
|
|
Delegate a debug call to the underlying logger, after adding
|
|
|
|
contextual information from this adapter instance.
|
|
|
|
"""
|
|
|
|
msg, kwargs = self.process(msg, kwargs)
|
|
|
|
self.logger.debug(msg, *args, **kwargs)
|
|
|
|
|
|
|
|
The :meth:`process` method of :class:`LoggerAdapter` is where the contextual
|
|
|
|
information is added to the logging output. It's passed the message and
|
|
|
|
keyword arguments of the logging call, and it passes back (potentially)
|
|
|
|
modified versions of these to use in the call to the underlying logger. The
|
|
|
|
default implementation of this method leaves the message alone, but inserts
|
|
|
|
an "extra" key in the keyword argument whose value is the dict-like object
|
|
|
|
passed to the constructor. Of course, if you had passed an "extra" keyword
|
|
|
|
argument in the call to the adapter, it will be silently overwritten.
|
|
|
|
|
|
|
|
The advantage of using "extra" is that the values in the dict-like object are
|
|
|
|
merged into the :class:`LogRecord` instance's __dict__, allowing you to use
|
|
|
|
customized strings with your :class:`Formatter` instances which know about
|
|
|
|
the keys of the dict-like object. If you need a different method, e.g. if you
|
|
|
|
want to prepend or append the contextual information to the message string,
|
|
|
|
you just need to subclass :class:`LoggerAdapter` and override :meth:`process`
|
|
|
|
to do what you need. Here's an example script which uses this class, which
|
|
|
|
also illustrates what dict-like behaviour is needed from an arbitrary
|
|
|
|
"dict-like" object for use in the constructor::
|
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
import logging
|
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
........
r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
#1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
........
r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
mmap is an extension module.
........
r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix example.
........
r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
#1555501: document plistlib and move it to the general library.
........
r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Add a stub for bundlebuilder documentation.
........
r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
........
r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
#997912: acknowledge nested scopes in tutorial.
........
r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
........
r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt pydoc to new doc URLs.
........
r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix old link.
........
r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
#1726198: replace while 1: fp.readline() with file iteration.
........
r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
Clarify $ behavior in re docstring. #1631394.
........
r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
Minor documentation change - hyperlink tidied up.
........
r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
#1530959: change distutils build dir for --with-pydebug python builds.
........
r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
Updated to include news on recent logging fixes and documentation changes.
........
r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
........
r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
Add NEWS entry for #1882.
........
r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
Use original location of document, which has translations.
........
r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
Follow PEP 8 in module docstring.
........
r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt to latest doctools refactoring.
........
2008-01-21 16:36:10 -04:00
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
class ConnInfo:
|
|
|
|
"""
|
|
|
|
An example class which shows how an arbitrary class can be used as
|
|
|
|
the 'extra' context information repository passed to a LoggerAdapter.
|
|
|
|
"""
|
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
........
r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
#1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
........
r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
mmap is an extension module.
........
r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix example.
........
r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
#1555501: document plistlib and move it to the general library.
........
r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Add a stub for bundlebuilder documentation.
........
r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
........
r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
#997912: acknowledge nested scopes in tutorial.
........
r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
........
r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt pydoc to new doc URLs.
........
r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix old link.
........
r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
#1726198: replace while 1: fp.readline() with file iteration.
........
r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
Clarify $ behavior in re docstring. #1631394.
........
r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
Minor documentation change - hyperlink tidied up.
........
r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
#1530959: change distutils build dir for --with-pydebug python builds.
........
r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
Updated to include news on recent logging fixes and documentation changes.
........
r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
........
r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
Add NEWS entry for #1882.
........
r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
Use original location of document, which has translations.
........
r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
Follow PEP 8 in module docstring.
........
r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt to latest doctools refactoring.
........
2008-01-21 16:36:10 -04:00
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
def __getitem__(self, name):
|
|
|
|
"""
|
|
|
|
To allow this instance to look like a dict.
|
|
|
|
"""
|
|
|
|
from random import choice
|
|
|
|
if name == "ip":
|
|
|
|
result = choice(["127.0.0.1", "192.168.0.1"])
|
|
|
|
elif name == "user":
|
|
|
|
result = choice(["jim", "fred", "sheila"])
|
|
|
|
else:
|
|
|
|
result = self.__dict__.get(name, "?")
|
|
|
|
return result
|
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
........
r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
#1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
........
r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
mmap is an extension module.
........
r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix example.
........
r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
#1555501: document plistlib and move it to the general library.
........
r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Add a stub for bundlebuilder documentation.
........
r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
........
r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
#997912: acknowledge nested scopes in tutorial.
........
r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
........
r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt pydoc to new doc URLs.
........
r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix old link.
........
r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
#1726198: replace while 1: fp.readline() with file iteration.
........
r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
Clarify $ behavior in re docstring. #1631394.
........
r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
Minor documentation change - hyperlink tidied up.
........
r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
#1530959: change distutils build dir for --with-pydebug python builds.
........
r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
Updated to include news on recent logging fixes and documentation changes.
........
r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
........
r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
Add NEWS entry for #1882.
........
r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
Use original location of document, which has translations.
........
r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
Follow PEP 8 in module docstring.
........
r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt to latest doctools refactoring.
........
2008-01-21 16:36:10 -04:00
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
def __iter__(self):
|
|
|
|
"""
|
|
|
|
To allow iteration over keys, which will be merged into
|
|
|
|
the LogRecord dict before formatting and output.
|
|
|
|
"""
|
|
|
|
keys = ["ip", "user"]
|
|
|
|
keys.extend(self.__dict__.keys())
|
|
|
|
return keys.__iter__()
|
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
........
r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
#1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
........
r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
mmap is an extension module.
........
r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix example.
........
r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
#1555501: document plistlib and move it to the general library.
........
r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Add a stub for bundlebuilder documentation.
........
r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
........
r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
#997912: acknowledge nested scopes in tutorial.
........
r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
........
r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt pydoc to new doc URLs.
........
r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix old link.
........
r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
#1726198: replace while 1: fp.readline() with file iteration.
........
r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
Clarify $ behavior in re docstring. #1631394.
........
r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
Minor documentation change - hyperlink tidied up.
........
r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
#1530959: change distutils build dir for --with-pydebug python builds.
........
r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
Updated to include news on recent logging fixes and documentation changes.
........
r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
........
r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
Add NEWS entry for #1882.
........
r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
Use original location of document, which has translations.
........
r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
Follow PEP 8 in module docstring.
........
r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt to latest doctools refactoring.
........
2008-01-21 16:36:10 -04:00
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
if __name__ == "__main__":
|
|
|
|
from random import choice
|
|
|
|
levels = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL)
|
|
|
|
a1 = logging.LoggerAdapter(logging.getLogger("a.b.c"),
|
|
|
|
{ "ip" : "123.231.231.123", "user" : "sheila" })
|
|
|
|
logging.basicConfig(level=logging.DEBUG,
|
|
|
|
format="%(asctime)-15s %(name)-5s %(levelname)-8s IP: %(ip)-15s User: %(user)-8s %(message)s")
|
|
|
|
a1.debug("A debug message")
|
|
|
|
a1.info("An info message with %s", "some parameters")
|
|
|
|
a2 = logging.LoggerAdapter(logging.getLogger("d.e.f"), ConnInfo())
|
|
|
|
for x in range(10):
|
|
|
|
lvl = choice(levels)
|
|
|
|
lvlname = logging.getLevelName(lvl)
|
|
|
|
a2.log(lvl, "A message at %s level with %d %s", lvlname, 2, "parameters")
|
2008-01-18 14:40:46 -04:00
|
|
|
|
|
|
|
When this script is run, the output should look something like this::
|
|
|
|
|
Merged revisions 60053-60078 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60054 | christian.heimes | 2008-01-18 20:12:56 +0100 (Fri, 18 Jan 2008) | 1 line
Silence Coverity false alerts with CIDs #172, #183, #184
........
r60057 | guido.van.rossum | 2008-01-18 21:56:30 +0100 (Fri, 18 Jan 2008) | 3 lines
Fix an edge case whereby the __del__() method of a classic class could
create a new weakref to the object.
........
r60058 | raymond.hettinger | 2008-01-18 22:14:58 +0100 (Fri, 18 Jan 2008) | 1 line
Better variable name in an example.
........
r60063 | guido.van.rossum | 2008-01-19 00:05:40 +0100 (Sat, 19 Jan 2008) | 3 lines
This got fixed for classic classes in r60057,
and backported to 2.5.2 in 60056.
........
r60068 | jeffrey.yasskin | 2008-01-19 10:56:06 +0100 (Sat, 19 Jan 2008) | 4 lines
Several tweaks: add construction from strings and .from_decimal(), change
__init__ to __new__ to enforce immutability, and remove "rational." from repr
and the parens from str.
........
r60069 | georg.brandl | 2008-01-19 11:11:27 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix markup.
........
r60070 | georg.brandl | 2008-01-19 11:16:09 +0100 (Sat, 19 Jan 2008) | 3 lines
Amend curses docs by info how to write non-ascii characters.
Thanks to Jeroen Ruigrok van der Werven.
........
r60071 | georg.brandl | 2008-01-19 11:18:07 +0100 (Sat, 19 Jan 2008) | 2 lines
Indentation normalization.
........
r60073 | facundo.batista | 2008-01-19 13:32:27 +0100 (Sat, 19 Jan 2008) | 5 lines
Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for a
just-created (and empty) instance. Added tests for this. Thanks
Jonathan Share.
........
r60074 | andrew.kuchling | 2008-01-19 14:33:20 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60075 | christian.heimes | 2008-01-19 14:46:06 +0100 (Sat, 19 Jan 2008) | 1 line
Added unit test to verify that threading.local doesn't cause ref leaks. It seems that the thread local storage always keeps the storage of the last stopped thread alive. Can anybody comment on it, please?
........
r60076 | christian.heimes | 2008-01-19 16:06:09 +0100 (Sat, 19 Jan 2008) | 1 line
Update for threading.local test.
........
r60077 | andrew.kuchling | 2008-01-19 16:16:37 +0100 (Sat, 19 Jan 2008) | 1 line
Polish sentence
........
r60078 | georg.brandl | 2008-01-19 16:22:16 +0100 (Sat, 19 Jan 2008) | 2 lines
Fix typos.
........
2008-01-19 12:21:02 -04:00
|
|
|
2008-01-18 14:49:54,023 a.b.c DEBUG IP: 123.231.231.123 User: sheila A debug message
|
|
|
|
2008-01-18 14:49:54,023 a.b.c INFO IP: 123.231.231.123 User: sheila An info message with some parameters
|
|
|
|
2008-01-18 14:49:54,023 d.e.f CRITICAL IP: 192.168.0.1 User: jim A message at CRITICAL level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f INFO IP: 192.168.0.1 User: jim A message at INFO level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f WARNING IP: 192.168.0.1 User: sheila A message at WARNING level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f ERROR IP: 127.0.0.1 User: fred A message at ERROR level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f ERROR IP: 127.0.0.1 User: sheila A message at ERROR level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f WARNING IP: 192.168.0.1 User: sheila A message at WARNING level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f WARNING IP: 192.168.0.1 User: jim A message at WARNING level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f INFO IP: 192.168.0.1 User: fred A message at INFO level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f WARNING IP: 192.168.0.1 User: sheila A message at WARNING level with 2 parameters
|
|
|
|
2008-01-18 14:49:54,033 d.e.f WARNING IP: 127.0.0.1 User: jim A message at WARNING level with 2 parameters
|
2008-01-18 14:40:46 -04:00
|
|
|
|
Merged revisions 59822-59841 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59822 | georg.brandl | 2008-01-07 17:43:47 +0100 (Mon, 07 Jan 2008) | 2 lines
Restore "somenamedtuple" as the "class" for named tuple attrs.
........
r59824 | georg.brandl | 2008-01-07 18:09:35 +0100 (Mon, 07 Jan 2008) | 2 lines
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
........
r59827 | georg.brandl | 2008-01-07 18:25:53 +0100 (Mon, 07 Jan 2008) | 2 lines
patch #1668: clarify envvar docs; rename THREADDEBUG to PYTHONTHREADDEBUG.
........
r59830 | georg.brandl | 2008-01-07 19:16:36 +0100 (Mon, 07 Jan 2008) | 2 lines
Make Python compile with --disable-unicode.
........
r59831 | georg.brandl | 2008-01-07 19:23:27 +0100 (Mon, 07 Jan 2008) | 2 lines
Restructure urllib doc structure.
........
r59833 | georg.brandl | 2008-01-07 19:41:34 +0100 (Mon, 07 Jan 2008) | 2 lines
Fix #define ordering.
........
r59834 | georg.brandl | 2008-01-07 19:47:44 +0100 (Mon, 07 Jan 2008) | 2 lines
#467924, patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall.
........
r59835 | raymond.hettinger | 2008-01-07 19:52:19 +0100 (Mon, 07 Jan 2008) | 1 line
Fix inconsistent title levels -- it made the whole doc build crash horribly.
........
r59836 | georg.brandl | 2008-01-07 19:57:03 +0100 (Mon, 07 Jan 2008) | 2 lines
Fix two further doc build warnings.
........
r59837 | georg.brandl | 2008-01-07 20:17:10 +0100 (Mon, 07 Jan 2008) | 2 lines
Clarify metaclass docs and add example.
........
r59838 | vinay.sajip | 2008-01-07 20:40:10 +0100 (Mon, 07 Jan 2008) | 1 line
Added section about adding contextual information to log output.
........
r59839 | christian.heimes | 2008-01-07 20:58:41 +0100 (Mon, 07 Jan 2008) | 1 line
Fixed indention problem that caused the second TIPC test to run on systems without TIPC
........
r59840 | raymond.hettinger | 2008-01-07 21:07:38 +0100 (Mon, 07 Jan 2008) | 1 line
Cleanup named tuple subclassing example.
........
2008-01-07 17:14:23 -04:00
|
|
|
|
2009-08-15 20:23:37 -03:00
|
|
|
Logging to a single file from multiple processes
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
Although logging is thread-safe, and logging to a single file from multiple
|
|
|
|
threads in a single process *is* supported, logging to a single file from
|
|
|
|
*multiple processes* is *not* supported, because there is no standard way to
|
|
|
|
serialize access to a single file across multiple processes in Python. If you
|
|
|
|
need to log to a single file from multiple processes, the best way of doing
|
|
|
|
this is to have all the processes log to a :class:`SocketHandler`, and have a
|
|
|
|
separate process which implements a socket server which reads from the socket
|
|
|
|
and logs to file. (If you prefer, you can dedicate one thread in one of the
|
|
|
|
existing processes to perform this function.) The following section documents
|
|
|
|
this approach in more detail and includes a working socket receiver which can
|
|
|
|
be used as a starting point for you to adapt in your own applications.
|
|
|
|
|
2009-08-15 20:35:08 -03:00
|
|
|
If you are using a recent version of Python which includes the
|
|
|
|
:mod:`multiprocessing` module, you can write your own handler which uses the
|
|
|
|
:class:`Lock` class from this module to serialize access to the file from
|
|
|
|
your processes. The existing :class:`FileHandler` and subclasses do not make
|
|
|
|
use of :mod:`multiprocessing` at present, though they may do so in the future.
|
2009-08-17 10:17:47 -03:00
|
|
|
Note that at present, the :mod:`multiprocessing` module does not provide
|
|
|
|
working lock functionality on all platforms (see
|
|
|
|
http://bugs.python.org/issue3770).
|
2009-08-15 20:35:08 -03:00
|
|
|
|
Merged revisions 74277,74321,74323,74326,74355,74465,74467,74488,74492,74513,74531,74549,74553,74625,74632,74643-74644,74647,74652,74666,74671,74727,74739 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74277 | sean.reifschneider | 2009-08-01 18:54:55 -0500 (Sat, 01 Aug 2009) | 3 lines
- Issue #6624: yArg_ParseTuple with "s" format when parsing argument with
NUL: Bogus TypeError detail string.
........
r74321 | guilherme.polo | 2009-08-05 11:51:41 -0500 (Wed, 05 Aug 2009) | 1 line
Easier reference to find (at least while svn continues being used).
........
r74323 | guilherme.polo | 2009-08-05 18:48:26 -0500 (Wed, 05 Aug 2009) | 1 line
Typo.
........
r74326 | jesse.noller | 2009-08-05 21:05:56 -0500 (Wed, 05 Aug 2009) | 1 line
Fix issue 4660: spurious task_done errors in multiprocessing, remove doc note for from_address
........
r74355 | gregory.p.smith | 2009-08-12 12:02:37 -0500 (Wed, 12 Aug 2009) | 2 lines
comment typo fix
........
r74465 | vinay.sajip | 2009-08-15 18:23:12 -0500 (Sat, 15 Aug 2009) | 1 line
Added section on logging to one file from multiple processes.
........
r74467 | vinay.sajip | 2009-08-15 18:34:47 -0500 (Sat, 15 Aug 2009) | 1 line
Refined section on logging to one file from multiple processes.
........
r74488 | vinay.sajip | 2009-08-17 08:14:37 -0500 (Mon, 17 Aug 2009) | 1 line
Further refined section on logging to one file from multiple processes.
........
r74492 | r.david.murray | 2009-08-17 14:26:49 -0500 (Mon, 17 Aug 2009) | 2 lines
Issue 6685: 'toupper' -> 'upper' in cgi doc example explanation.
........
r74513 | skip.montanaro | 2009-08-18 09:37:52 -0500 (Tue, 18 Aug 2009) | 1 line
missing module ref (issue6723)
........
r74531 | vinay.sajip | 2009-08-20 17:04:32 -0500 (Thu, 20 Aug 2009) | 1 line
Added section on exceptions raised during logging.
........
r74549 | benjamin.peterson | 2009-08-24 12:42:36 -0500 (Mon, 24 Aug 2009) | 1 line
fix pdf building by teaching latex the right encoding package
........
r74553 | r.david.murray | 2009-08-26 20:04:59 -0500 (Wed, 26 Aug 2009) | 2 lines
Remove leftover text from end of sentence.
........
r74625 | benjamin.peterson | 2009-09-01 17:27:57 -0500 (Tue, 01 Sep 2009) | 1 line
remove the check that classmethod's argument is a callable
........
r74632 | georg.brandl | 2009-09-03 02:27:26 -0500 (Thu, 03 Sep 2009) | 1 line
#6828: fix wrongly highlighted blocks.
........
r74643 | georg.brandl | 2009-09-04 01:59:20 -0500 (Fri, 04 Sep 2009) | 2 lines
Issue #2666: Handle BROWSER environment variable properly for unknown browser names in the webbrowser module.
........
r74644 | georg.brandl | 2009-09-04 02:55:14 -0500 (Fri, 04 Sep 2009) | 1 line
#5047: remove Monterey support from configure.
........
r74647 | georg.brandl | 2009-09-04 03:17:04 -0500 (Fri, 04 Sep 2009) | 2 lines
Issue #5275: In Cookie's Cookie.load(), properly handle non-string arguments as documented.
........
r74652 | georg.brandl | 2009-09-04 06:25:37 -0500 (Fri, 04 Sep 2009) | 1 line
#6756: add some info about the "acct" parameter.
........
r74666 | georg.brandl | 2009-09-05 04:04:09 -0500 (Sat, 05 Sep 2009) | 1 line
#6841: remove duplicated word.
........
r74671 | georg.brandl | 2009-09-05 11:47:17 -0500 (Sat, 05 Sep 2009) | 1 line
#6843: add link from filterwarnings to where the meaning of the arguments is covered.
........
r74727 | benjamin.peterson | 2009-09-08 18:04:22 -0500 (Tue, 08 Sep 2009) | 1 line
#6865 fix ref counting in initialization of pwd module
........
r74739 | georg.brandl | 2009-09-11 02:55:20 -0500 (Fri, 11 Sep 2009) | 1 line
Move function back to its section.
........
2009-09-11 19:24:02 -03:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
.. _network-logging:
|
|
|
|
|
|
|
|
Sending and receiving logging events across a network
|
|
|
|
-----------------------------------------------------
|
|
|
|
|
|
|
|
Let's say you want to send logging events across a network, and handle them at
|
|
|
|
the receiving end. A simple way of doing this is attaching a
|
|
|
|
:class:`SocketHandler` instance to the root logger at the sending end::
|
|
|
|
|
|
|
|
import logging, logging.handlers
|
|
|
|
|
|
|
|
rootLogger = logging.getLogger('')
|
|
|
|
rootLogger.setLevel(logging.DEBUG)
|
|
|
|
socketHandler = logging.handlers.SocketHandler('localhost',
|
|
|
|
logging.handlers.DEFAULT_TCP_LOGGING_PORT)
|
|
|
|
# don't bother with a formatter, since a socket handler sends the event as
|
|
|
|
# an unformatted pickle
|
|
|
|
rootLogger.addHandler(socketHandler)
|
|
|
|
|
|
|
|
# Now, we can log to the root logger, or any other logger. First the root...
|
|
|
|
logging.info('Jackdaws love my big sphinx of quartz.')
|
|
|
|
|
|
|
|
# Now, define a couple of other loggers which might represent areas in your
|
|
|
|
# application:
|
|
|
|
|
|
|
|
logger1 = logging.getLogger('myapp.area1')
|
|
|
|
logger2 = logging.getLogger('myapp.area2')
|
|
|
|
|
|
|
|
logger1.debug('Quick zephyrs blow, vexing daft Jim.')
|
|
|
|
logger1.info('How quickly daft jumping zebras vex.')
|
|
|
|
logger2.warning('Jail zesty vixen who grabbed pay from quack.')
|
|
|
|
logger2.error('The five boxing wizards jump quickly.')
|
|
|
|
|
2008-05-11 23:31:37 -03:00
|
|
|
At the receiving end, you can set up a receiver using the :mod:`socketserver`
|
2007-08-15 11:28:22 -03:00
|
|
|
module. Here is a basic working example::
|
|
|
|
|
2009-05-31 13:41:59 -03:00
|
|
|
import pickle
|
2007-08-15 11:28:22 -03:00
|
|
|
import logging
|
|
|
|
import logging.handlers
|
2008-05-11 23:31:37 -03:00
|
|
|
import socketserver
|
2007-08-15 11:28:22 -03:00
|
|
|
import struct
|
|
|
|
|
|
|
|
|
2008-05-11 23:31:37 -03:00
|
|
|
class LogRecordStreamHandler(socketserver.StreamRequestHandler):
|
2007-08-15 11:28:22 -03:00
|
|
|
"""Handler for a streaming logging request.
|
|
|
|
|
|
|
|
This basically logs the record using whatever logging policy is
|
|
|
|
configured locally.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def handle(self):
|
|
|
|
"""
|
|
|
|
Handle multiple requests - each expected to be a 4-byte length,
|
|
|
|
followed by the LogRecord in pickle format. Logs the record
|
|
|
|
according to whatever policy is configured locally.
|
|
|
|
"""
|
2007-09-09 21:49:57 -03:00
|
|
|
while True:
|
2007-08-15 11:28:22 -03:00
|
|
|
chunk = self.connection.recv(4)
|
|
|
|
if len(chunk) < 4:
|
|
|
|
break
|
|
|
|
slen = struct.unpack(">L", chunk)[0]
|
|
|
|
chunk = self.connection.recv(slen)
|
|
|
|
while len(chunk) < slen:
|
|
|
|
chunk = chunk + self.connection.recv(slen - len(chunk))
|
|
|
|
obj = self.unPickle(chunk)
|
|
|
|
record = logging.makeLogRecord(obj)
|
|
|
|
self.handleLogRecord(record)
|
|
|
|
|
|
|
|
def unPickle(self, data):
|
2009-05-31 13:41:59 -03:00
|
|
|
return pickle.loads(data)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
def handleLogRecord(self, record):
|
|
|
|
# if a name is specified, we use the named logger rather than the one
|
|
|
|
# implied by the record.
|
|
|
|
if self.server.logname is not None:
|
|
|
|
name = self.server.logname
|
|
|
|
else:
|
|
|
|
name = record.name
|
|
|
|
logger = logging.getLogger(name)
|
|
|
|
# N.B. EVERY record gets logged. This is because Logger.handle
|
|
|
|
# is normally called AFTER logger-level filtering. If you want
|
|
|
|
# to do filtering, do it at the client end to save wasting
|
|
|
|
# cycles and network bandwidth!
|
|
|
|
logger.handle(record)
|
|
|
|
|
2008-05-11 23:31:37 -03:00
|
|
|
class LogRecordSocketReceiver(socketserver.ThreadingTCPServer):
|
2007-08-15 11:28:22 -03:00
|
|
|
"""simple TCP socket-based logging receiver suitable for testing.
|
|
|
|
"""
|
|
|
|
|
|
|
|
allow_reuse_address = 1
|
|
|
|
|
|
|
|
def __init__(self, host='localhost',
|
|
|
|
port=logging.handlers.DEFAULT_TCP_LOGGING_PORT,
|
|
|
|
handler=LogRecordStreamHandler):
|
2008-05-11 23:31:37 -03:00
|
|
|
socketserver.ThreadingTCPServer.__init__(self, (host, port), handler)
|
2007-08-15 11:28:22 -03:00
|
|
|
self.abort = 0
|
|
|
|
self.timeout = 1
|
|
|
|
self.logname = None
|
|
|
|
|
|
|
|
def serve_until_stopped(self):
|
|
|
|
import select
|
|
|
|
abort = 0
|
|
|
|
while not abort:
|
|
|
|
rd, wr, ex = select.select([self.socket.fileno()],
|
|
|
|
[], [],
|
|
|
|
self.timeout)
|
|
|
|
if rd:
|
|
|
|
self.handle_request()
|
|
|
|
abort = self.abort
|
|
|
|
|
|
|
|
def main():
|
|
|
|
logging.basicConfig(
|
|
|
|
format="%(relativeCreated)5d %(name)-15s %(levelname)-8s %(message)s")
|
|
|
|
tcpserver = LogRecordSocketReceiver()
|
2007-09-04 04:15:32 -03:00
|
|
|
print("About to start TCP server...")
|
2007-08-15 11:28:22 -03:00
|
|
|
tcpserver.serve_until_stopped()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
|
|
|
|
|
|
|
First run the server, and then the client. On the client side, nothing is
|
|
|
|
printed on the console; on the server side, you should see something like::
|
|
|
|
|
|
|
|
About to start TCP server...
|
|
|
|
59 root INFO Jackdaws love my big sphinx of quartz.
|
|
|
|
59 myapp.area1 DEBUG Quick zephyrs blow, vexing daft Jim.
|
|
|
|
69 myapp.area1 INFO How quickly daft jumping zebras vex.
|
|
|
|
69 myapp.area2 WARNING Jail zesty vixen who grabbed pay from quack.
|
|
|
|
69 myapp.area2 ERROR The five boxing wizards jump quickly.
|
|
|
|
|
Merged revisions 74779-74786,74793,74795,74811,74860-74861,74863,74876,74886,74896,74901,74903,74908,74912,74930,74933,74943,74946,74952-74955,75015,75019,75032,75068,75076,75095,75098,75102,75129,75139,75230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74779 | michael.foord | 2009-09-13 11:13:36 -0500 (Sun, 13 Sep 2009) | 1 line
Change to tutorial wording for reading text / binary files on Windows. Issue #6301.
........
r74780 | michael.foord | 2009-09-13 11:40:02 -0500 (Sun, 13 Sep 2009) | 1 line
Objects that compare equal automatically pass or fail assertAlmostEqual and assertNotAlmostEqual tests on unittest.TestCase. Issue 6567.
........
r74781 | michael.foord | 2009-09-13 11:46:19 -0500 (Sun, 13 Sep 2009) | 1 line
Note that sys._getframe is not guaranteed to exist in all implementations of Python, and a corresponding note in inspect.currentframe. Issue 6712.
........
r74782 | michael.foord | 2009-09-13 12:07:46 -0500 (Sun, 13 Sep 2009) | 1 line
Tutorial tweaks. Issue 6849.
........
r74783 | michael.foord | 2009-09-13 12:28:35 -0500 (Sun, 13 Sep 2009) | 1 line
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
........
r74784 | georg.brandl | 2009-09-13 13:15:07 -0500 (Sun, 13 Sep 2009) | 1 line
Typo fix.
........
r74785 | michael.foord | 2009-09-13 14:07:03 -0500 (Sun, 13 Sep 2009) | 1 line
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
........
r74786 | michael.foord | 2009-09-13 14:08:18 -0500 (Sun, 13 Sep 2009) | 1 line
Remove an extraneous space in unittest documentation.
........
r74793 | georg.brandl | 2009-09-14 09:50:47 -0500 (Mon, 14 Sep 2009) | 1 line
#6908: fix association of hashlib hash attributes.
........
r74795 | benjamin.peterson | 2009-09-14 22:36:26 -0500 (Mon, 14 Sep 2009) | 1 line
Py_SetPythonHome uses static storage #6913
........
r74811 | georg.brandl | 2009-09-15 15:26:59 -0500 (Tue, 15 Sep 2009) | 1 line
Add Armin Ronacher.
........
r74860 | benjamin.peterson | 2009-09-16 21:46:54 -0500 (Wed, 16 Sep 2009) | 1 line
kill bare except
........
r74861 | benjamin.peterson | 2009-09-16 22:18:28 -0500 (Wed, 16 Sep 2009) | 1 line
pep 8 defaults
........
r74863 | benjamin.peterson | 2009-09-16 22:27:33 -0500 (Wed, 16 Sep 2009) | 1 line
rationalize a bit
........
r74876 | georg.brandl | 2009-09-17 11:15:53 -0500 (Thu, 17 Sep 2009) | 1 line
#6932: remove paragraph that advises relying on __del__ being called.
........
r74886 | benjamin.peterson | 2009-09-17 16:33:46 -0500 (Thu, 17 Sep 2009) | 1 line
use macros
........
r74896 | georg.brandl | 2009-09-18 02:22:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6936: for interactive use, quit() is just fine.
........
r74901 | georg.brandl | 2009-09-18 04:14:52 -0500 (Fri, 18 Sep 2009) | 1 line
#6905: use better exception messages in inspect when the argument is of the wrong type.
........
r74903 | georg.brandl | 2009-09-18 04:18:27 -0500 (Fri, 18 Sep 2009) | 1 line
#6938: "ident" is always a string, so use a format code which works.
........
r74908 | georg.brandl | 2009-09-18 08:57:11 -0500 (Fri, 18 Sep 2009) | 1 line
Use str.format() to fix beginner's mistake with %-style string formatting.
........
r74912 | georg.brandl | 2009-09-18 11:19:56 -0500 (Fri, 18 Sep 2009) | 1 line
Optimize optimization and fix method name in docstring.
........
r74930 | georg.brandl | 2009-09-18 16:21:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6925: rewrite docs for locals() and vars() a bit.
........
r74933 | georg.brandl | 2009-09-18 16:35:59 -0500 (Fri, 18 Sep 2009) | 1 line
#6930: clarify description about byteorder handling in UTF decoder routines.
........
r74943 | georg.brandl | 2009-09-19 02:35:07 -0500 (Sat, 19 Sep 2009) | 1 line
#6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple.
........
r74946 | georg.brandl | 2009-09-19 03:43:16 -0500 (Sat, 19 Sep 2009) | 1 line
Update bug tracker reference.
........
r74952 | georg.brandl | 2009-09-19 05:42:34 -0500 (Sat, 19 Sep 2009) | 1 line
#6946: fix duplicate index entries for datetime classes.
........
r74953 | georg.brandl | 2009-09-19 07:04:16 -0500 (Sat, 19 Sep 2009) | 1 line
Fix references to threading.enumerate().
........
r74954 | georg.brandl | 2009-09-19 08:13:56 -0500 (Sat, 19 Sep 2009) | 1 line
Add Doug.
........
r74955 | georg.brandl | 2009-09-19 08:20:49 -0500 (Sat, 19 Sep 2009) | 1 line
Add Mark Summerfield.
........
r75015 | georg.brandl | 2009-09-22 05:55:08 -0500 (Tue, 22 Sep 2009) | 1 line
Fix encoding name.
........
r75019 | vinay.sajip | 2009-09-22 12:23:41 -0500 (Tue, 22 Sep 2009) | 1 line
Fixed a typo, and added sections on optimization and using arbitrary objects as messages.
........
r75032 | benjamin.peterson | 2009-09-22 17:15:28 -0500 (Tue, 22 Sep 2009) | 1 line
fix typos/rephrase
........
r75068 | benjamin.peterson | 2009-09-25 21:57:59 -0500 (Fri, 25 Sep 2009) | 1 line
comment out ugly xxx
........
r75076 | vinay.sajip | 2009-09-26 09:53:32 -0500 (Sat, 26 Sep 2009) | 1 line
Tidied up name of parameter in StreamHandler
........
r75095 | michael.foord | 2009-09-27 14:15:41 -0500 (Sun, 27 Sep 2009) | 1 line
Test creation moved from TestProgram.parseArgs to TestProgram.createTests exclusively. Issue 6956.
........
r75098 | michael.foord | 2009-09-27 15:08:23 -0500 (Sun, 27 Sep 2009) | 1 line
Documentation improvement for load_tests protocol in unittest. Issue 6515.
........
r75102 | skip.montanaro | 2009-09-27 21:12:27 -0500 (Sun, 27 Sep 2009) | 3 lines
Patch from Thomas Barr so that csv.Sniffer will set doublequote property.
Closes issue 6606.
........
r75129 | vinay.sajip | 2009-09-29 02:08:54 -0500 (Tue, 29 Sep 2009) | 1 line
Issue #7014: logging: Improved IronPython 2.6 compatibility.
........
r75139 | raymond.hettinger | 2009-09-29 13:53:24 -0500 (Tue, 29 Sep 2009) | 3 lines
Issue 7008: Better document str.title and show how to work around the apostrophe problem.
........
r75230 | benjamin.peterson | 2009-10-04 08:38:38 -0500 (Sun, 04 Oct 2009) | 1 line
test logging
........
2009-10-04 11:49:41 -03:00
|
|
|
Using arbitrary objects as messages
|
|
|
|
-----------------------------------
|
|
|
|
|
|
|
|
In the preceding sections and examples, it has been assumed that the message
|
|
|
|
passed when logging the event is a string. However, this is not the only
|
|
|
|
possibility. You can pass an arbitrary object as a message, and its
|
|
|
|
:meth:`__str__` method will be called when the logging system needs to convert
|
|
|
|
it to a string representation. In fact, if you want to, you can avoid
|
|
|
|
computing a string representation altogether - for example, the
|
|
|
|
:class:`SocketHandler` emits an event by pickling it and sending it over the
|
|
|
|
wire.
|
|
|
|
|
|
|
|
Optimization
|
|
|
|
------------
|
|
|
|
|
|
|
|
Formatting of message arguments is deferred until it cannot be avoided.
|
|
|
|
However, computing the arguments passed to the logging method can also be
|
|
|
|
expensive, and you may want to avoid doing it if the logger will just throw
|
|
|
|
away your event. To decide what to do, you can call the :meth:`isEnabledFor`
|
|
|
|
method which takes a level argument and returns true if the event would be
|
|
|
|
created by the Logger for that level of call. You can write code like this::
|
|
|
|
|
|
|
|
if logger.isEnabledFor(logging.DEBUG):
|
|
|
|
logger.debug("Message with %s, %s", expensive_func1(),
|
|
|
|
expensive_func2())
|
|
|
|
|
|
|
|
so that if the logger's threshold is set above ``DEBUG``, the calls to
|
|
|
|
:func:`expensive_func1` and :func:`expensive_func2` are never made.
|
|
|
|
|
|
|
|
There are other optimizations which can be made for specific applications which
|
|
|
|
need more precise control over what logging information is collected. Here's a
|
|
|
|
list of things you can do to avoid processing during logging which you don't
|
|
|
|
need:
|
|
|
|
|
|
|
|
+-----------------------------------------------+----------------------------------------+
|
|
|
|
| What you don't want to collect | How to avoid collecting it |
|
|
|
|
+===============================================+========================================+
|
|
|
|
| Information about where calls were made from. | Set ``logging._srcfile`` to ``None``. |
|
|
|
|
+-----------------------------------------------+----------------------------------------+
|
|
|
|
| Threading information. | Set ``logging.logThreads`` to ``0``. |
|
|
|
|
+-----------------------------------------------+----------------------------------------+
|
|
|
|
| Process information. | Set ``logging.logProcesses`` to ``0``. |
|
|
|
|
+-----------------------------------------------+----------------------------------------+
|
|
|
|
|
|
|
|
Also note that the core logging module only includes the basic handlers. If
|
|
|
|
you don't import :mod:`logging.handlers` and :mod:`logging.config`, they won't
|
|
|
|
take up any memory.
|
|
|
|
|
|
|
|
.. _handler:
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Handler Objects
|
|
|
|
---------------
|
|
|
|
|
|
|
|
Handlers have the following attributes and methods. Note that :class:`Handler`
|
|
|
|
is never instantiated directly; this class acts as a base for more useful
|
|
|
|
subclasses. However, the :meth:`__init__` method in subclasses needs to call
|
|
|
|
:meth:`Handler.__init__`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.__init__(level=NOTSET)
|
|
|
|
|
|
|
|
Initializes the :class:`Handler` instance by setting its level, setting the list
|
|
|
|
of filters to the empty list and creating a lock (using :meth:`createLock`) for
|
|
|
|
serializing access to an I/O mechanism.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.createLock()
|
|
|
|
|
|
|
|
Initializes a thread lock which can be used to serialize access to underlying
|
|
|
|
I/O functionality which may not be threadsafe.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.acquire()
|
|
|
|
|
|
|
|
Acquires the thread lock created with :meth:`createLock`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.release()
|
|
|
|
|
|
|
|
Releases the thread lock acquired with :meth:`acquire`.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.setLevel(lvl)
|
|
|
|
|
|
|
|
Sets the threshold for this handler to *lvl*. Logging messages which are less
|
|
|
|
severe than *lvl* will be ignored. When a handler is created, the level is set
|
|
|
|
to :const:`NOTSET` (which causes all messages to be processed).
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.setFormatter(form)
|
|
|
|
|
|
|
|
Sets the :class:`Formatter` for this handler to *form*.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.addFilter(filt)
|
|
|
|
|
|
|
|
Adds the specified filter *filt* to this handler.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.removeFilter(filt)
|
|
|
|
|
|
|
|
Removes the specified filter *filt* from this handler.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.filter(record)
|
|
|
|
|
|
|
|
Applies this handler's filters to the record and returns a true value if the
|
|
|
|
record is to be processed.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.flush()
|
|
|
|
|
|
|
|
Ensure all logging output has been flushed. This version does nothing and is
|
|
|
|
intended to be implemented by subclasses.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.close()
|
|
|
|
|
Merged revisions 66045,66048-66049,66053,66060,66062-66063,66065,66067,66071-66074,66080,66082-66083,66090-66093,66097-66099,66103,66105,66110,66118 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66045 | andrew.kuchling | 2008-08-26 19:27:18 -0500 (Tue, 26 Aug 2008) | 1 line
Trim whitespace; add a few updates
........
r66048 | andrew.kuchling | 2008-08-26 19:45:02 -0500 (Tue, 26 Aug 2008) | 1 line
Add an item and a note
........
r66049 | andrew.kuchling | 2008-08-26 21:12:18 -0500 (Tue, 26 Aug 2008) | 1 line
Add various items
........
r66053 | georg.brandl | 2008-08-28 04:40:18 -0500 (Thu, 28 Aug 2008) | 2 lines
#3711: .dll isn't a valid Python extension anymore.
........
r66060 | armin.rigo | 2008-08-29 16:21:52 -0500 (Fri, 29 Aug 2008) | 3 lines
A collection of crashers, all variants of the idea
of issue #3720.
........
r66062 | georg.brandl | 2008-08-30 04:49:36 -0500 (Sat, 30 Aug 2008) | 2 lines
#3730: mention "server" attribute explicitly.
........
r66063 | georg.brandl | 2008-08-30 04:52:44 -0500 (Sat, 30 Aug 2008) | 2 lines
#3716: fix typo.
........
r66065 | georg.brandl | 2008-08-30 05:03:09 -0500 (Sat, 30 Aug 2008) | 2 lines
#3569: eval() also accepts "exec"able code objects.
........
r66067 | georg.brandl | 2008-08-30 08:17:39 -0500 (Sat, 30 Aug 2008) | 2 lines
super() actually returns a super object.
........
r66071 | andrew.kuchling | 2008-08-30 10:19:57 -0500 (Sat, 30 Aug 2008) | 1 line
Partial edits from revision and tidying pass
........
r66072 | andrew.kuchling | 2008-08-30 10:21:23 -0500 (Sat, 30 Aug 2008) | 1 line
Tidy up some sentences
........
r66073 | andrew.kuchling | 2008-08-30 10:25:47 -0500 (Sat, 30 Aug 2008) | 1 line
Correction from Antoine Pitrou: BufferedWriter and Reader support seek()
........
r66074 | andrew.kuchling | 2008-08-30 11:44:54 -0500 (Sat, 30 Aug 2008) | 1 line
Edit four more sections
........
r66080 | georg.brandl | 2008-08-30 17:00:28 -0500 (Sat, 30 Aug 2008) | 2 lines
Fix markup.
........
r66082 | andrew.kuchling | 2008-08-30 17:56:54 -0500 (Sat, 30 Aug 2008) | 1 line
More edits; markup fixes
........
r66083 | andrew.kuchling | 2008-08-30 21:24:08 -0500 (Sat, 30 Aug 2008) | 1 line
More edits
........
r66090 | andrew.kuchling | 2008-08-31 09:29:31 -0500 (Sun, 31 Aug 2008) | 1 line
Edit the library section, rearranging items to flow better and making lots of edits
........
r66091 | andrew.kuchling | 2008-08-31 10:41:48 -0500 (Sun, 31 Aug 2008) | 1 line
Last batch of edits; remove the 'other changes' section
........
r66092 | andrew.kuchling | 2008-08-31 10:48:44 -0500 (Sun, 31 Aug 2008) | 1 line
Update patch/bug count
........
r66093 | gregory.p.smith | 2008-08-31 11:34:18 -0500 (Sun, 31 Aug 2008) | 3 lines
issue3715: docstring representation of hex escaped string needs to be double
escaped.
........
r66097 | benjamin.peterson | 2008-09-01 09:13:43 -0500 (Mon, 01 Sep 2008) | 4 lines
#3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
........
r66098 | georg.brandl | 2008-09-01 09:15:55 -0500 (Mon, 01 Sep 2008) | 2 lines
#3749: fix c'n'p errors.
........
r66099 | benjamin.peterson | 2008-09-01 09:18:30 -0500 (Mon, 01 Sep 2008) | 4 lines
Fix compilation when --without-threads is given #3683
Reviewer: Georg Brandl, Benjamin Peterson
........
r66103 | vinay.sajip | 2008-09-01 09:30:10 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66105 | vinay.sajip | 2008-09-01 09:33:59 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66110 | vinay.sajip | 2008-09-01 10:08:07 -0500 (Mon, 01 Sep 2008) | 1 line
Added section about configuring logging in a library. Thanks to Thomas Heller for the idea.
........
r66118 | vinay.sajip | 2008-09-01 12:44:14 -0500 (Mon, 01 Sep 2008) | 1 line
Bug #3738: Documentation is now more accurate in describing handler close methods.
........
2008-09-01 21:31:15 -03:00
|
|
|
Tidy up any resources used by the handler. This version does no output but
|
|
|
|
removes the handler from an internal list of handlers which is closed when
|
|
|
|
:func:`shutdown` is called. Subclasses should ensure that this gets called
|
|
|
|
from overridden :meth:`close` methods.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.handle(record)
|
|
|
|
|
|
|
|
Conditionally emits the specified logging record, depending on filters which may
|
|
|
|
have been added to the handler. Wraps the actual emission of the record with
|
|
|
|
acquisition/release of the I/O thread lock.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.handleError(record)
|
|
|
|
|
|
|
|
This method should be called from handlers when an exception is encountered
|
|
|
|
during an :meth:`emit` call. By default it does nothing, which means that
|
|
|
|
exceptions get silently ignored. This is what is mostly wanted for a logging
|
|
|
|
system - most users will not care about errors in the logging system, they are
|
|
|
|
more interested in application errors. You could, however, replace this with a
|
|
|
|
custom handler if you wish. The specified record is the one which was being
|
|
|
|
processed when the exception occurred.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.format(record)
|
|
|
|
|
|
|
|
Do formatting for a record - if a formatter is set, use it. Otherwise, use the
|
|
|
|
default formatter for the module.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: Handler.emit(record)
|
|
|
|
|
|
|
|
Do whatever it takes to actually log the specified logging record. This version
|
|
|
|
is intended to be implemented by subclasses and so raises a
|
|
|
|
:exc:`NotImplementedError`.
|
|
|
|
|
|
|
|
|
|
|
|
StreamHandler
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`StreamHandler` class, located in the core :mod:`logging` package,
|
|
|
|
sends logging output to streams such as *sys.stdout*, *sys.stderr* or any
|
|
|
|
file-like object (or, more precisely, any object which supports :meth:`write`
|
|
|
|
and :meth:`flush` methods).
|
|
|
|
|
|
|
|
|
Merged revisions 76847,76851,76869,76882,76891-76892,76924,77007,77070,77092,77096,77120,77126,77155 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76847 | benjamin.peterson | 2009-12-14 21:25:27 -0600 (Mon, 14 Dec 2009) | 1 line
adverb
........
r76851 | benjamin.peterson | 2009-12-15 21:28:52 -0600 (Tue, 15 Dec 2009) | 1 line
remove lib2to3 resource
........
r76869 | vinay.sajip | 2009-12-17 08:52:00 -0600 (Thu, 17 Dec 2009) | 1 line
Issue #7529: logging: Minor correction to documentation.
........
r76882 | georg.brandl | 2009-12-19 11:30:28 -0600 (Sat, 19 Dec 2009) | 1 line
#7527: use standard versionadded tags.
........
r76891 | georg.brandl | 2009-12-19 12:16:31 -0600 (Sat, 19 Dec 2009) | 1 line
#7479: add note about function availability on Unices.
........
r76892 | georg.brandl | 2009-12-19 12:20:18 -0600 (Sat, 19 Dec 2009) | 1 line
#7480: remove tautology.
........
r76924 | georg.brandl | 2009-12-20 08:28:05 -0600 (Sun, 20 Dec 2009) | 1 line
Small indentation fix.
........
r77007 | gregory.p.smith | 2009-12-23 03:31:11 -0600 (Wed, 23 Dec 2009) | 3 lines
Fix possible integer overflow in lchown and fchown functions. For issue1747858.
........
r77070 | amaury.forgeotdarc | 2009-12-27 14:06:44 -0600 (Sun, 27 Dec 2009) | 2 lines
Fix a typo in comment
........
r77092 | georg.brandl | 2009-12-28 02:48:24 -0600 (Mon, 28 Dec 2009) | 1 line
#7404: remove reference to non-existing example files.
........
r77096 | benjamin.peterson | 2009-12-28 14:51:17 -0600 (Mon, 28 Dec 2009) | 1 line
document new fix_callable behavior
........
r77120 | georg.brandl | 2009-12-29 15:09:17 -0600 (Tue, 29 Dec 2009) | 1 line
#7595: fix typo in argument default constant.
........
r77126 | amaury.forgeotdarc | 2009-12-29 17:06:17 -0600 (Tue, 29 Dec 2009) | 2 lines
#7579: Add docstrings to the msvcrt module
........
r77155 | georg.brandl | 2009-12-30 13:03:00 -0600 (Wed, 30 Dec 2009) | 1 line
We only support Windows NT derivatives now.
........
2009-12-30 23:11:23 -04:00
|
|
|
.. currentmodule:: logging
|
|
|
|
|
Merged revisions 74779-74786,74793,74795,74811,74860-74861,74863,74876,74886,74896,74901,74903,74908,74912,74930,74933,74943,74946,74952-74955,75015,75019,75032,75068,75076,75095,75098,75102,75129,75139,75230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74779 | michael.foord | 2009-09-13 11:13:36 -0500 (Sun, 13 Sep 2009) | 1 line
Change to tutorial wording for reading text / binary files on Windows. Issue #6301.
........
r74780 | michael.foord | 2009-09-13 11:40:02 -0500 (Sun, 13 Sep 2009) | 1 line
Objects that compare equal automatically pass or fail assertAlmostEqual and assertNotAlmostEqual tests on unittest.TestCase. Issue 6567.
........
r74781 | michael.foord | 2009-09-13 11:46:19 -0500 (Sun, 13 Sep 2009) | 1 line
Note that sys._getframe is not guaranteed to exist in all implementations of Python, and a corresponding note in inspect.currentframe. Issue 6712.
........
r74782 | michael.foord | 2009-09-13 12:07:46 -0500 (Sun, 13 Sep 2009) | 1 line
Tutorial tweaks. Issue 6849.
........
r74783 | michael.foord | 2009-09-13 12:28:35 -0500 (Sun, 13 Sep 2009) | 1 line
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
........
r74784 | georg.brandl | 2009-09-13 13:15:07 -0500 (Sun, 13 Sep 2009) | 1 line
Typo fix.
........
r74785 | michael.foord | 2009-09-13 14:07:03 -0500 (Sun, 13 Sep 2009) | 1 line
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
........
r74786 | michael.foord | 2009-09-13 14:08:18 -0500 (Sun, 13 Sep 2009) | 1 line
Remove an extraneous space in unittest documentation.
........
r74793 | georg.brandl | 2009-09-14 09:50:47 -0500 (Mon, 14 Sep 2009) | 1 line
#6908: fix association of hashlib hash attributes.
........
r74795 | benjamin.peterson | 2009-09-14 22:36:26 -0500 (Mon, 14 Sep 2009) | 1 line
Py_SetPythonHome uses static storage #6913
........
r74811 | georg.brandl | 2009-09-15 15:26:59 -0500 (Tue, 15 Sep 2009) | 1 line
Add Armin Ronacher.
........
r74860 | benjamin.peterson | 2009-09-16 21:46:54 -0500 (Wed, 16 Sep 2009) | 1 line
kill bare except
........
r74861 | benjamin.peterson | 2009-09-16 22:18:28 -0500 (Wed, 16 Sep 2009) | 1 line
pep 8 defaults
........
r74863 | benjamin.peterson | 2009-09-16 22:27:33 -0500 (Wed, 16 Sep 2009) | 1 line
rationalize a bit
........
r74876 | georg.brandl | 2009-09-17 11:15:53 -0500 (Thu, 17 Sep 2009) | 1 line
#6932: remove paragraph that advises relying on __del__ being called.
........
r74886 | benjamin.peterson | 2009-09-17 16:33:46 -0500 (Thu, 17 Sep 2009) | 1 line
use macros
........
r74896 | georg.brandl | 2009-09-18 02:22:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6936: for interactive use, quit() is just fine.
........
r74901 | georg.brandl | 2009-09-18 04:14:52 -0500 (Fri, 18 Sep 2009) | 1 line
#6905: use better exception messages in inspect when the argument is of the wrong type.
........
r74903 | georg.brandl | 2009-09-18 04:18:27 -0500 (Fri, 18 Sep 2009) | 1 line
#6938: "ident" is always a string, so use a format code which works.
........
r74908 | georg.brandl | 2009-09-18 08:57:11 -0500 (Fri, 18 Sep 2009) | 1 line
Use str.format() to fix beginner's mistake with %-style string formatting.
........
r74912 | georg.brandl | 2009-09-18 11:19:56 -0500 (Fri, 18 Sep 2009) | 1 line
Optimize optimization and fix method name in docstring.
........
r74930 | georg.brandl | 2009-09-18 16:21:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6925: rewrite docs for locals() and vars() a bit.
........
r74933 | georg.brandl | 2009-09-18 16:35:59 -0500 (Fri, 18 Sep 2009) | 1 line
#6930: clarify description about byteorder handling in UTF decoder routines.
........
r74943 | georg.brandl | 2009-09-19 02:35:07 -0500 (Sat, 19 Sep 2009) | 1 line
#6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple.
........
r74946 | georg.brandl | 2009-09-19 03:43:16 -0500 (Sat, 19 Sep 2009) | 1 line
Update bug tracker reference.
........
r74952 | georg.brandl | 2009-09-19 05:42:34 -0500 (Sat, 19 Sep 2009) | 1 line
#6946: fix duplicate index entries for datetime classes.
........
r74953 | georg.brandl | 2009-09-19 07:04:16 -0500 (Sat, 19 Sep 2009) | 1 line
Fix references to threading.enumerate().
........
r74954 | georg.brandl | 2009-09-19 08:13:56 -0500 (Sat, 19 Sep 2009) | 1 line
Add Doug.
........
r74955 | georg.brandl | 2009-09-19 08:20:49 -0500 (Sat, 19 Sep 2009) | 1 line
Add Mark Summerfield.
........
r75015 | georg.brandl | 2009-09-22 05:55:08 -0500 (Tue, 22 Sep 2009) | 1 line
Fix encoding name.
........
r75019 | vinay.sajip | 2009-09-22 12:23:41 -0500 (Tue, 22 Sep 2009) | 1 line
Fixed a typo, and added sections on optimization and using arbitrary objects as messages.
........
r75032 | benjamin.peterson | 2009-09-22 17:15:28 -0500 (Tue, 22 Sep 2009) | 1 line
fix typos/rephrase
........
r75068 | benjamin.peterson | 2009-09-25 21:57:59 -0500 (Fri, 25 Sep 2009) | 1 line
comment out ugly xxx
........
r75076 | vinay.sajip | 2009-09-26 09:53:32 -0500 (Sat, 26 Sep 2009) | 1 line
Tidied up name of parameter in StreamHandler
........
r75095 | michael.foord | 2009-09-27 14:15:41 -0500 (Sun, 27 Sep 2009) | 1 line
Test creation moved from TestProgram.parseArgs to TestProgram.createTests exclusively. Issue 6956.
........
r75098 | michael.foord | 2009-09-27 15:08:23 -0500 (Sun, 27 Sep 2009) | 1 line
Documentation improvement for load_tests protocol in unittest. Issue 6515.
........
r75102 | skip.montanaro | 2009-09-27 21:12:27 -0500 (Sun, 27 Sep 2009) | 3 lines
Patch from Thomas Barr so that csv.Sniffer will set doublequote property.
Closes issue 6606.
........
r75129 | vinay.sajip | 2009-09-29 02:08:54 -0500 (Tue, 29 Sep 2009) | 1 line
Issue #7014: logging: Improved IronPython 2.6 compatibility.
........
r75139 | raymond.hettinger | 2009-09-29 13:53:24 -0500 (Tue, 29 Sep 2009) | 3 lines
Issue 7008: Better document str.title and show how to work around the apostrophe problem.
........
r75230 | benjamin.peterson | 2009-10-04 08:38:38 -0500 (Sun, 04 Oct 2009) | 1 line
test logging
........
2009-10-04 11:49:41 -03:00
|
|
|
.. class:: StreamHandler(stream=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 74779-74786,74793,74795,74811,74860-74861,74863,74876,74886,74896,74901,74903,74908,74912,74930,74933,74943,74946,74952-74955,75015,75019,75032,75068,75076,75095,75098,75102,75129,75139,75230 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74779 | michael.foord | 2009-09-13 11:13:36 -0500 (Sun, 13 Sep 2009) | 1 line
Change to tutorial wording for reading text / binary files on Windows. Issue #6301.
........
r74780 | michael.foord | 2009-09-13 11:40:02 -0500 (Sun, 13 Sep 2009) | 1 line
Objects that compare equal automatically pass or fail assertAlmostEqual and assertNotAlmostEqual tests on unittest.TestCase. Issue 6567.
........
r74781 | michael.foord | 2009-09-13 11:46:19 -0500 (Sun, 13 Sep 2009) | 1 line
Note that sys._getframe is not guaranteed to exist in all implementations of Python, and a corresponding note in inspect.currentframe. Issue 6712.
........
r74782 | michael.foord | 2009-09-13 12:07:46 -0500 (Sun, 13 Sep 2009) | 1 line
Tutorial tweaks. Issue 6849.
........
r74783 | michael.foord | 2009-09-13 12:28:35 -0500 (Sun, 13 Sep 2009) | 1 line
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
........
r74784 | georg.brandl | 2009-09-13 13:15:07 -0500 (Sun, 13 Sep 2009) | 1 line
Typo fix.
........
r74785 | michael.foord | 2009-09-13 14:07:03 -0500 (Sun, 13 Sep 2009) | 1 line
Test discovery in unittest will only attempt to import modules that are importable; i.e. their names are valid Python identifiers. If an import fails during discovery this will be recorded as an error and test discovery will continue. Issue 6568.
........
r74786 | michael.foord | 2009-09-13 14:08:18 -0500 (Sun, 13 Sep 2009) | 1 line
Remove an extraneous space in unittest documentation.
........
r74793 | georg.brandl | 2009-09-14 09:50:47 -0500 (Mon, 14 Sep 2009) | 1 line
#6908: fix association of hashlib hash attributes.
........
r74795 | benjamin.peterson | 2009-09-14 22:36:26 -0500 (Mon, 14 Sep 2009) | 1 line
Py_SetPythonHome uses static storage #6913
........
r74811 | georg.brandl | 2009-09-15 15:26:59 -0500 (Tue, 15 Sep 2009) | 1 line
Add Armin Ronacher.
........
r74860 | benjamin.peterson | 2009-09-16 21:46:54 -0500 (Wed, 16 Sep 2009) | 1 line
kill bare except
........
r74861 | benjamin.peterson | 2009-09-16 22:18:28 -0500 (Wed, 16 Sep 2009) | 1 line
pep 8 defaults
........
r74863 | benjamin.peterson | 2009-09-16 22:27:33 -0500 (Wed, 16 Sep 2009) | 1 line
rationalize a bit
........
r74876 | georg.brandl | 2009-09-17 11:15:53 -0500 (Thu, 17 Sep 2009) | 1 line
#6932: remove paragraph that advises relying on __del__ being called.
........
r74886 | benjamin.peterson | 2009-09-17 16:33:46 -0500 (Thu, 17 Sep 2009) | 1 line
use macros
........
r74896 | georg.brandl | 2009-09-18 02:22:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6936: for interactive use, quit() is just fine.
........
r74901 | georg.brandl | 2009-09-18 04:14:52 -0500 (Fri, 18 Sep 2009) | 1 line
#6905: use better exception messages in inspect when the argument is of the wrong type.
........
r74903 | georg.brandl | 2009-09-18 04:18:27 -0500 (Fri, 18 Sep 2009) | 1 line
#6938: "ident" is always a string, so use a format code which works.
........
r74908 | georg.brandl | 2009-09-18 08:57:11 -0500 (Fri, 18 Sep 2009) | 1 line
Use str.format() to fix beginner's mistake with %-style string formatting.
........
r74912 | georg.brandl | 2009-09-18 11:19:56 -0500 (Fri, 18 Sep 2009) | 1 line
Optimize optimization and fix method name in docstring.
........
r74930 | georg.brandl | 2009-09-18 16:21:41 -0500 (Fri, 18 Sep 2009) | 1 line
#6925: rewrite docs for locals() and vars() a bit.
........
r74933 | georg.brandl | 2009-09-18 16:35:59 -0500 (Fri, 18 Sep 2009) | 1 line
#6930: clarify description about byteorder handling in UTF decoder routines.
........
r74943 | georg.brandl | 2009-09-19 02:35:07 -0500 (Sat, 19 Sep 2009) | 1 line
#6944: the argument to PyArg_ParseTuple should be a tuple, otherwise a SystemError is set. Also clean up another usage of PyArg_ParseTuple.
........
r74946 | georg.brandl | 2009-09-19 03:43:16 -0500 (Sat, 19 Sep 2009) | 1 line
Update bug tracker reference.
........
r74952 | georg.brandl | 2009-09-19 05:42:34 -0500 (Sat, 19 Sep 2009) | 1 line
#6946: fix duplicate index entries for datetime classes.
........
r74953 | georg.brandl | 2009-09-19 07:04:16 -0500 (Sat, 19 Sep 2009) | 1 line
Fix references to threading.enumerate().
........
r74954 | georg.brandl | 2009-09-19 08:13:56 -0500 (Sat, 19 Sep 2009) | 1 line
Add Doug.
........
r74955 | georg.brandl | 2009-09-19 08:20:49 -0500 (Sat, 19 Sep 2009) | 1 line
Add Mark Summerfield.
........
r75015 | georg.brandl | 2009-09-22 05:55:08 -0500 (Tue, 22 Sep 2009) | 1 line
Fix encoding name.
........
r75019 | vinay.sajip | 2009-09-22 12:23:41 -0500 (Tue, 22 Sep 2009) | 1 line
Fixed a typo, and added sections on optimization and using arbitrary objects as messages.
........
r75032 | benjamin.peterson | 2009-09-22 17:15:28 -0500 (Tue, 22 Sep 2009) | 1 line
fix typos/rephrase
........
r75068 | benjamin.peterson | 2009-09-25 21:57:59 -0500 (Fri, 25 Sep 2009) | 1 line
comment out ugly xxx
........
r75076 | vinay.sajip | 2009-09-26 09:53:32 -0500 (Sat, 26 Sep 2009) | 1 line
Tidied up name of parameter in StreamHandler
........
r75095 | michael.foord | 2009-09-27 14:15:41 -0500 (Sun, 27 Sep 2009) | 1 line
Test creation moved from TestProgram.parseArgs to TestProgram.createTests exclusively. Issue 6956.
........
r75098 | michael.foord | 2009-09-27 15:08:23 -0500 (Sun, 27 Sep 2009) | 1 line
Documentation improvement for load_tests protocol in unittest. Issue 6515.
........
r75102 | skip.montanaro | 2009-09-27 21:12:27 -0500 (Sun, 27 Sep 2009) | 3 lines
Patch from Thomas Barr so that csv.Sniffer will set doublequote property.
Closes issue 6606.
........
r75129 | vinay.sajip | 2009-09-29 02:08:54 -0500 (Tue, 29 Sep 2009) | 1 line
Issue #7014: logging: Improved IronPython 2.6 compatibility.
........
r75139 | raymond.hettinger | 2009-09-29 13:53:24 -0500 (Tue, 29 Sep 2009) | 3 lines
Issue 7008: Better document str.title and show how to work around the apostrophe problem.
........
r75230 | benjamin.peterson | 2009-10-04 08:38:38 -0500 (Sun, 04 Oct 2009) | 1 line
test logging
........
2009-10-04 11:49:41 -03:00
|
|
|
Returns a new instance of the :class:`StreamHandler` class. If *stream* is
|
2007-08-15 11:28:22 -03:00
|
|
|
specified, the instance will use it for logging output; otherwise, *sys.stderr*
|
|
|
|
will be used.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
If a formatter is specified, it is used to format the record. The record
|
|
|
|
is then written to the stream with a trailing newline. If exception
|
|
|
|
information is present, it is formatted using
|
|
|
|
:func:`traceback.print_exception` and appended to the stream.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: flush()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Flushes the stream by calling its :meth:`flush` method. Note that the
|
|
|
|
:meth:`close` method is inherited from :class:`Handler` and so does
|
Merged revisions 66045,66048-66049,66053,66060,66062-66063,66065,66067,66071-66074,66080,66082-66083,66090-66093,66097-66099,66103,66105,66110,66118 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66045 | andrew.kuchling | 2008-08-26 19:27:18 -0500 (Tue, 26 Aug 2008) | 1 line
Trim whitespace; add a few updates
........
r66048 | andrew.kuchling | 2008-08-26 19:45:02 -0500 (Tue, 26 Aug 2008) | 1 line
Add an item and a note
........
r66049 | andrew.kuchling | 2008-08-26 21:12:18 -0500 (Tue, 26 Aug 2008) | 1 line
Add various items
........
r66053 | georg.brandl | 2008-08-28 04:40:18 -0500 (Thu, 28 Aug 2008) | 2 lines
#3711: .dll isn't a valid Python extension anymore.
........
r66060 | armin.rigo | 2008-08-29 16:21:52 -0500 (Fri, 29 Aug 2008) | 3 lines
A collection of crashers, all variants of the idea
of issue #3720.
........
r66062 | georg.brandl | 2008-08-30 04:49:36 -0500 (Sat, 30 Aug 2008) | 2 lines
#3730: mention "server" attribute explicitly.
........
r66063 | georg.brandl | 2008-08-30 04:52:44 -0500 (Sat, 30 Aug 2008) | 2 lines
#3716: fix typo.
........
r66065 | georg.brandl | 2008-08-30 05:03:09 -0500 (Sat, 30 Aug 2008) | 2 lines
#3569: eval() also accepts "exec"able code objects.
........
r66067 | georg.brandl | 2008-08-30 08:17:39 -0500 (Sat, 30 Aug 2008) | 2 lines
super() actually returns a super object.
........
r66071 | andrew.kuchling | 2008-08-30 10:19:57 -0500 (Sat, 30 Aug 2008) | 1 line
Partial edits from revision and tidying pass
........
r66072 | andrew.kuchling | 2008-08-30 10:21:23 -0500 (Sat, 30 Aug 2008) | 1 line
Tidy up some sentences
........
r66073 | andrew.kuchling | 2008-08-30 10:25:47 -0500 (Sat, 30 Aug 2008) | 1 line
Correction from Antoine Pitrou: BufferedWriter and Reader support seek()
........
r66074 | andrew.kuchling | 2008-08-30 11:44:54 -0500 (Sat, 30 Aug 2008) | 1 line
Edit four more sections
........
r66080 | georg.brandl | 2008-08-30 17:00:28 -0500 (Sat, 30 Aug 2008) | 2 lines
Fix markup.
........
r66082 | andrew.kuchling | 2008-08-30 17:56:54 -0500 (Sat, 30 Aug 2008) | 1 line
More edits; markup fixes
........
r66083 | andrew.kuchling | 2008-08-30 21:24:08 -0500 (Sat, 30 Aug 2008) | 1 line
More edits
........
r66090 | andrew.kuchling | 2008-08-31 09:29:31 -0500 (Sun, 31 Aug 2008) | 1 line
Edit the library section, rearranging items to flow better and making lots of edits
........
r66091 | andrew.kuchling | 2008-08-31 10:41:48 -0500 (Sun, 31 Aug 2008) | 1 line
Last batch of edits; remove the 'other changes' section
........
r66092 | andrew.kuchling | 2008-08-31 10:48:44 -0500 (Sun, 31 Aug 2008) | 1 line
Update patch/bug count
........
r66093 | gregory.p.smith | 2008-08-31 11:34:18 -0500 (Sun, 31 Aug 2008) | 3 lines
issue3715: docstring representation of hex escaped string needs to be double
escaped.
........
r66097 | benjamin.peterson | 2008-09-01 09:13:43 -0500 (Mon, 01 Sep 2008) | 4 lines
#3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
........
r66098 | georg.brandl | 2008-09-01 09:15:55 -0500 (Mon, 01 Sep 2008) | 2 lines
#3749: fix c'n'p errors.
........
r66099 | benjamin.peterson | 2008-09-01 09:18:30 -0500 (Mon, 01 Sep 2008) | 4 lines
Fix compilation when --without-threads is given #3683
Reviewer: Georg Brandl, Benjamin Peterson
........
r66103 | vinay.sajip | 2008-09-01 09:30:10 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66105 | vinay.sajip | 2008-09-01 09:33:59 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66110 | vinay.sajip | 2008-09-01 10:08:07 -0500 (Mon, 01 Sep 2008) | 1 line
Added section about configuring logging in a library. Thanks to Thomas Heller for the idea.
........
r66118 | vinay.sajip | 2008-09-01 12:44:14 -0500 (Mon, 01 Sep 2008) | 1 line
Bug #3738: Documentation is now more accurate in describing handler close methods.
........
2008-09-01 21:31:15 -03:00
|
|
|
no output, so an explicit :meth:`flush` call may be needed at times.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
FileHandler
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`FileHandler` class, located in the core :mod:`logging` package,
|
|
|
|
sends logging output to a disk file. It inherits the output functionality from
|
|
|
|
:class:`StreamHandler`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: FileHandler(filename, mode='a', encoding=None, delay=0)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`FileHandler` class. The specified file is
|
|
|
|
opened and used as the stream for logging. If *mode* is not specified,
|
|
|
|
:const:`'a'` is used. If *encoding* is not *None*, it is used to open the file
|
2008-01-24 12:21:45 -04:00
|
|
|
with that encoding. If *delay* is true, then file opening is deferred until the
|
|
|
|
first call to :meth:`emit`. By default, the file grows indefinitely.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: close()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Closes the file.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Outputs the record to the file.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-01-02 14:53:45 -04:00
|
|
|
NullHandler
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
.. versionadded:: 3.1
|
|
|
|
|
|
|
|
The :class:`NullHandler` class, located in the core :mod:`logging` package,
|
|
|
|
does not do any formatting or output. It is essentially a "no-op" handler
|
|
|
|
for use by library developers.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: NullHandler()
|
|
|
|
|
|
|
|
Returns a new instance of the :class:`NullHandler` class.
|
|
|
|
|
|
|
|
|
|
|
|
.. method:: emit(record)
|
|
|
|
|
|
|
|
This method does nothing.
|
|
|
|
|
2009-01-10 09:37:26 -04:00
|
|
|
See :ref:`library-config` for more information on how to use
|
|
|
|
:class:`NullHandler`.
|
2009-01-09 00:11:44 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
WatchedFileHandler
|
|
|
|
^^^^^^^^^^^^^^^^^^
|
|
|
|
|
Merged revisions 68450,68480-68481,68493,68495,68501,68512,68514-68515,68534-68536,68552,68563,68570-68572,68575,68582,68596,68623-68624,68628 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68450 | jeffrey.yasskin | 2009-01-09 10:47:07 -0600 (Fri, 09 Jan 2009) | 3 lines
Fix issue 4884, preventing a crash in the socket code when python is compiled
with llvm-gcc and run with a glibc <2.10.
........
r68480 | vinay.sajip | 2009-01-10 07:38:04 -0600 (Sat, 10 Jan 2009) | 1 line
Minor documentation changes cross-referencing NullHandler to the documentation on configuring logging in a library.
........
r68481 | vinay.sajip | 2009-01-10 07:42:04 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected an incorrect self-reference.
........
r68493 | benjamin.peterson | 2009-01-10 11:18:55 -0600 (Sat, 10 Jan 2009) | 1 line
rewrite verbose conditionals
........
r68495 | benjamin.peterson | 2009-01-10 11:36:44 -0600 (Sat, 10 Jan 2009) | 1 line
tp_iter only exists with Py_TPFLAGS_HAVE_ITER #4901
........
r68501 | vinay.sajip | 2009-01-10 13:22:57 -0600 (Sat, 10 Jan 2009) | 1 line
Corrected minor typo and added .currentmodule directives to fix missing cross-references.
........
r68512 | benjamin.peterson | 2009-01-10 16:42:10 -0600 (Sat, 10 Jan 2009) | 1 line
make tests fail if they can't be imported
........
r68514 | benjamin.peterson | 2009-01-10 17:41:59 -0600 (Sat, 10 Jan 2009) | 1 line
move seealso to a more appropiate place
........
r68515 | benjamin.peterson | 2009-01-10 17:49:08 -0600 (Sat, 10 Jan 2009) | 1 line
macos 9 isn't supported
........
r68534 | gregory.p.smith | 2009-01-11 11:53:33 -0600 (Sun, 11 Jan 2009) | 2 lines
correct email address
........
r68535 | gregory.p.smith | 2009-01-11 11:57:54 -0600 (Sun, 11 Jan 2009) | 9 lines
Update the documentation for binascii and zlib crc32/adler32 functions
to better describe the signed vs unsigned return value behavior on
different platforms and versions of python. Mention the workaround to
make them all return the same thing by using & 0xffffffff.
Fixes issue4903.
Also needs to be merged into release26-maint, release30-maint, & py3k.
........
r68536 | benjamin.peterson | 2009-01-11 13:48:15 -0600 (Sun, 11 Jan 2009) | 1 line
add email addresses
........
r68552 | vinay.sajip | 2009-01-12 14:36:18 -0600 (Mon, 12 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68563 | benjamin.peterson | 2009-01-12 19:49:10 -0600 (Mon, 12 Jan 2009) | 1 line
small logic correction
........
r68570 | raymond.hettinger | 2009-01-13 03:08:32 -0600 (Tue, 13 Jan 2009) | 5 lines
Issue 4922: Incorrect comments for MutableSet.add() and MutableSet.discard().
Needs to be backported to 2.6 and forward ported to 3.0 and 3.1.
........
r68571 | armin.ronacher | 2009-01-13 05:52:23 -0600 (Tue, 13 Jan 2009) | 3 lines
ast.literal_eval can properly evaluate complex numbers now. This fixes issue4907.
........
r68572 | andrew.kuchling | 2009-01-13 07:40:54 -0600 (Tue, 13 Jan 2009) | 1 line
Note that first coord. is left alone
........
r68575 | thomas.heller | 2009-01-13 11:32:28 -0600 (Tue, 13 Jan 2009) | 1 line
Fix refcount leak in error cases. Bug found by coverity.
........
r68582 | georg.brandl | 2009-01-13 16:14:01 -0600 (Tue, 13 Jan 2009) | 2 lines
Use assertRaises.
........
r68596 | amaury.forgeotdarc | 2009-01-13 17:39:22 -0600 (Tue, 13 Jan 2009) | 3 lines
#1162154: inspect.getmembers() now skips attributes that raise AttributeError,
e.g. a __slots__ attribute which has not been set.
........
r68623 | vinay.sajip | 2009-01-15 16:48:13 -0600 (Thu, 15 Jan 2009) | 1 line
Made minor changes/corrections in markup. Added a couple of section headings.
........
r68624 | vinay.sajip | 2009-01-15 17:04:47 -0600 (Thu, 15 Jan 2009) | 1 line
Minor changes/corrections in markup.
........
r68628 | benjamin.peterson | 2009-01-15 20:55:24 -0600 (Thu, 15 Jan 2009) | 1 line
compare with == not is #4946
........
2009-01-15 23:54:08 -04:00
|
|
|
.. currentmodule:: logging.handlers
|
2009-01-02 14:53:45 -04:00
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
The :class:`WatchedFileHandler` class, located in the :mod:`logging.handlers`
|
|
|
|
module, is a :class:`FileHandler` which watches the file it is logging to. If
|
|
|
|
the file changes, it is closed and reopened using the file name.
|
|
|
|
|
|
|
|
A file change can happen because of usage of programs such as *newsyslog* and
|
|
|
|
*logrotate* which perform log file rotation. This handler, intended for use
|
|
|
|
under Unix/Linux, watches the file to see if it has changed since the last emit.
|
|
|
|
(A file is deemed to have changed if its device or inode have changed.) If the
|
|
|
|
file has changed, the old file stream is closed, and the file opened to get a
|
|
|
|
new stream.
|
|
|
|
|
|
|
|
This handler is not appropriate for use under Windows, because under Windows
|
|
|
|
open log files cannot be moved or renamed - logging opens the files with
|
|
|
|
exclusive locks - and so there is no need for such a handler. Furthermore,
|
|
|
|
*ST_INO* is not supported under Windows; :func:`stat` always returns zero for
|
|
|
|
this value.
|
|
|
|
|
|
|
|
|
2008-01-24 12:21:45 -04:00
|
|
|
.. class:: WatchedFileHandler(filename[,mode[, encoding[, delay]]])
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`WatchedFileHandler` class. The specified
|
|
|
|
file is opened and used as the stream for logging. If *mode* is not specified,
|
|
|
|
:const:`'a'` is used. If *encoding* is not *None*, it is used to open the file
|
2008-01-24 12:21:45 -04:00
|
|
|
with that encoding. If *delay* is true, then file opening is deferred until the
|
|
|
|
first call to :meth:`emit`. By default, the file grows indefinitely.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Outputs the record to the file, but first checks to see if the file has
|
|
|
|
changed. If it has, the existing stream is flushed and closed and the
|
|
|
|
file opened again, before outputting the record to the file.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
RotatingFileHandler
|
|
|
|
^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`RotatingFileHandler` class, located in the :mod:`logging.handlers`
|
|
|
|
module, supports rotation of disk log files.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`RotatingFileHandler` class. The specified
|
|
|
|
file is opened and used as the stream for logging. If *mode* is not specified,
|
2008-01-24 12:21:45 -04:00
|
|
|
``'a'`` is used. If *encoding* is not *None*, it is used to open the file
|
|
|
|
with that encoding. If *delay* is true, then file opening is deferred until the
|
|
|
|
first call to :meth:`emit`. By default, the file grows indefinitely.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
You can use the *maxBytes* and *backupCount* values to allow the file to
|
|
|
|
:dfn:`rollover` at a predetermined size. When the size is about to be exceeded,
|
|
|
|
the file is closed and a new file is silently opened for output. Rollover occurs
|
|
|
|
whenever the current log file is nearly *maxBytes* in length; if *maxBytes* is
|
|
|
|
zero, rollover never occurs. If *backupCount* is non-zero, the system will save
|
|
|
|
old log files by appending the extensions ".1", ".2" etc., to the filename. For
|
|
|
|
example, with a *backupCount* of 5 and a base file name of :file:`app.log`, you
|
|
|
|
would get :file:`app.log`, :file:`app.log.1`, :file:`app.log.2`, up to
|
|
|
|
:file:`app.log.5`. The file being written to is always :file:`app.log`. When
|
|
|
|
this file is filled, it is closed and renamed to :file:`app.log.1`, and if files
|
|
|
|
:file:`app.log.1`, :file:`app.log.2`, etc. exist, then they are renamed to
|
|
|
|
:file:`app.log.2`, :file:`app.log.3` etc. respectively.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: doRollover()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Does a rollover, as described above.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Outputs the record to the file, catering for rollover as described
|
|
|
|
previously.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
TimedRotatingFileHandler
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`TimedRotatingFileHandler` class, located in the
|
|
|
|
:mod:`logging.handlers` module, supports rotation of disk log files at certain
|
|
|
|
timed intervals.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=False)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`TimedRotatingFileHandler` class. The
|
|
|
|
specified file is opened and used as the stream for logging. On rotating it also
|
|
|
|
sets the filename suffix. Rotating happens based on the product of *when* and
|
|
|
|
*interval*.
|
|
|
|
|
|
|
|
You can use the *when* to specify the type of *interval*. The list of possible
|
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
|
|
|
values is below. Note that they are not case sensitive.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
Merged revisions 61143-61144,61146-61147,61150-61151,61157,61165-61168,61170-61173,61176-61177,61183 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r61143 | barry.warsaw | 2008-03-01 03:23:38 +0100 (Sat, 01 Mar 2008) | 2 lines
Bump to version 2.6a1
........
r61144 | barry.warsaw | 2008-03-01 03:26:42 +0100 (Sat, 01 Mar 2008) | 1 line
bump idle version number
........
r61146 | fred.drake | 2008-03-01 03:45:07 +0100 (Sat, 01 Mar 2008) | 2 lines
fix typo
........
r61147 | barry.warsaw | 2008-03-01 03:53:36 +0100 (Sat, 01 Mar 2008) | 1 line
Add date to NEWS
........
r61150 | barry.warsaw | 2008-03-01 04:00:52 +0100 (Sat, 01 Mar 2008) | 1 line
Give IDLE a release date
........
r61151 | barry.warsaw | 2008-03-01 04:15:20 +0100 (Sat, 01 Mar 2008) | 1 line
More copyright year and version number bumps
........
r61157 | barry.warsaw | 2008-03-01 18:11:41 +0100 (Sat, 01 Mar 2008) | 2 lines
Set things up for 2.6a2.
........
r61165 | georg.brandl | 2008-03-02 07:28:16 +0100 (Sun, 02 Mar 2008) | 2 lines
It's 2.6 now.
........
r61166 | georg.brandl | 2008-03-02 07:32:32 +0100 (Sun, 02 Mar 2008) | 2 lines
Update year.
........
r61167 | georg.brandl | 2008-03-02 07:44:08 +0100 (Sun, 02 Mar 2008) | 2 lines
Make patchlevel print out the release if called as a script.
........
r61168 | georg.brandl | 2008-03-02 07:45:40 +0100 (Sun, 02 Mar 2008) | 2 lines
New default basename for HTML help files.
........
r61170 | raymond.hettinger | 2008-03-02 11:59:31 +0100 (Sun, 02 Mar 2008) | 1 line
Finish-up docs for combinations() and permutations() in itertools.
........
r61171 | raymond.hettinger | 2008-03-02 12:17:51 +0100 (Sun, 02 Mar 2008) | 1 line
Tighten example code.
........
r61172 | raymond.hettinger | 2008-03-02 12:57:16 +0100 (Sun, 02 Mar 2008) | 1 line
Simplify code for itertools.product().
........
r61173 | raymond.hettinger | 2008-03-02 13:02:19 +0100 (Sun, 02 Mar 2008) | 1 line
Handle 0-tuples which can be singletons.
........
r61176 | georg.brandl | 2008-03-02 14:41:39 +0100 (Sun, 02 Mar 2008) | 2 lines
Make clear that the constants are strings.
........
r61177 | georg.brandl | 2008-03-02 15:15:04 +0100 (Sun, 02 Mar 2008) | 2 lines
Fix factual error.
........
r61183 | gregory.p.smith | 2008-03-02 21:00:53 +0100 (Sun, 02 Mar 2008) | 4 lines
Modify import of test_support so that the code can also be used with a
stand alone distribution of bsddb that includes its own small copy of
test_support for the needed functionality on older pythons.
........
2008-03-02 18:46:37 -04:00
|
|
|
+----------------+-----------------------+
|
|
|
|
| Value | Type of interval |
|
|
|
|
+================+=======================+
|
|
|
|
| ``'S'`` | Seconds |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
| ``'M'`` | Minutes |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
| ``'H'`` | Hours |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
| ``'D'`` | Days |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
| ``'W'`` | Week day (0=Monday) |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
| ``'midnight'`` | Roll over at midnight |
|
|
|
|
+----------------+-----------------------+
|
|
|
|
|
|
|
|
The system will save old log files by appending extensions to the filename.
|
|
|
|
The extensions are date-and-time based, using the strftime format
|
Merged revisions 62090-62091,62096,62100,62102,62110-62114 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62090 | brett.cannon | 2008-04-01 07:37:43 -0500 (Tue, 01 Apr 2008) | 3 lines
Generalize test.test_support.test_stdout() with a base context manager so that
it is easy to capture stderr if desired.
........
r62091 | brett.cannon | 2008-04-01 07:46:02 -0500 (Tue, 01 Apr 2008) | 3 lines
Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot
of effort to do so.
........
r62096 | amaury.forgeotdarc | 2008-04-01 17:52:48 -0500 (Tue, 01 Apr 2008) | 4 lines
Newly enabled test appears to leak:
it registers the same codec on each iteration.
Do it only once at load time.
........
r62100 | amaury.forgeotdarc | 2008-04-01 19:55:04 -0500 (Tue, 01 Apr 2008) | 4 lines
A DocTestSuite cannot run multiple times: it clears its globals dictionary after the first run.
Rebuild the DocTestSuite on each iteration.
........
r62102 | jeffrey.yasskin | 2008-04-01 23:07:44 -0500 (Tue, 01 Apr 2008) | 3 lines
Try to make test_signal less flaky. I still see some flakiness in
test_itimer_prof.
........
r62110 | vinay.sajip | 2008-04-02 16:09:27 -0500 (Wed, 02 Apr 2008) | 1 line
Fix: #2315, #2316, #2317: TimedRotatingFileHandler - changed logic to better handle daylight savings time, deletion of old log files, and fixed a bug in calculating rollover when no logging occurs for a longer interval than the rollover period.
........
r62111 | vinay.sajip | 2008-04-02 16:10:23 -0500 (Wed, 02 Apr 2008) | 1 line
Added updates with respect to recent changes to TimedRotatingFileHandler.
........
r62112 | vinay.sajip | 2008-04-02 16:17:25 -0500 (Wed, 02 Apr 2008) | 1 line
Added updates with respect to recent changes to TimedRotatingFileHandler.
........
r62113 | amaury.forgeotdarc | 2008-04-02 16:18:46 -0500 (Wed, 02 Apr 2008) | 2 lines
Remove debug prints; the buildbot now passes the tests
........
r62114 | benjamin.peterson | 2008-04-02 16:20:35 -0500 (Wed, 02 Apr 2008) | 2 lines
Suggested proposed changes to Python be considered on some mailing lists first
........
2008-04-02 18:49:44 -03:00
|
|
|
``%Y-%m-%d_%H-%M-%S`` or a leading portion thereof, depending on the
|
Merged revisions 65012,65035,65037-65040,65048,65057,65077,65091-65095,65097-65099,65127-65128,65131,65133-65136,65139,65149-65151,65155,65158-65159,65176-65178,65183-65184,65187-65190,65192,65194 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r65012 | jesse.noller | 2008-07-16 15:24:06 +0200 (Wed, 16 Jul 2008) | 2 lines
Apply patch for issue 3090: ARCHFLAGS parsing incorrect
........
r65035 | georg.brandl | 2008-07-16 23:19:28 +0200 (Wed, 16 Jul 2008) | 2 lines
#3045: fix pydoc behavior for TEMP path with spaces.
........
r65037 | georg.brandl | 2008-07-16 23:31:41 +0200 (Wed, 16 Jul 2008) | 2 lines
#1608818: errno can get set by every call to readdir().
........
r65038 | georg.brandl | 2008-07-17 00:04:20 +0200 (Thu, 17 Jul 2008) | 2 lines
#3305: self->stream can be NULL.
........
r65039 | georg.brandl | 2008-07-17 00:09:17 +0200 (Thu, 17 Jul 2008) | 2 lines
#3345: fix docstring.
........
r65040 | georg.brandl | 2008-07-17 00:33:18 +0200 (Thu, 17 Jul 2008) | 2 lines
#3312: fix two sqlite3 crashes.
........
r65048 | georg.brandl | 2008-07-17 01:35:54 +0200 (Thu, 17 Jul 2008) | 2 lines
#3388: add a paragraph about using "with" for file objects.
........
r65057 | gregory.p.smith | 2008-07-17 05:13:05 +0200 (Thu, 17 Jul 2008) | 2 lines
news note for r63052
........
r65077 | jesse.noller | 2008-07-17 23:01:05 +0200 (Thu, 17 Jul 2008) | 3 lines
Fix issue 3395, update _debugInfo to be _debug_info
........
r65091 | ronald.oussoren | 2008-07-18 07:48:03 +0200 (Fri, 18 Jul 2008) | 2 lines
Last bit of a fix for issue3381 (addon for my patch in r65061)
........
r65092 | vinay.sajip | 2008-07-18 10:59:06 +0200 (Fri, 18 Jul 2008) | 1 line
Issue #3389: Allow resolving dotted names for handlers in logging configuration files. Thanks to Philip Jenvey for the patch.
........
r65093 | vinay.sajip | 2008-07-18 11:00:00 +0200 (Fri, 18 Jul 2008) | 1 line
Issue #3389: Allow resolving dotted names for handlers in logging configuration files. Thanks to Philip Jenvey for the patch.
........
r65094 | vinay.sajip | 2008-07-18 11:00:35 +0200 (Fri, 18 Jul 2008) | 1 line
Issue #3389: Allow resolving dotted names for handlers in logging configuration files. Thanks to Philip Jenvey for the patch.
........
r65095 | vinay.sajip | 2008-07-18 11:01:10 +0200 (Fri, 18 Jul 2008) | 1 line
Issue #3389: Allow resolving dotted names for handlers in logging configuration files. Thanks to Philip Jenvey for the patch.
........
r65097 | georg.brandl | 2008-07-18 12:20:59 +0200 (Fri, 18 Jul 2008) | 2 lines
Remove duplicate entry in __all__.
........
r65098 | georg.brandl | 2008-07-18 12:29:30 +0200 (Fri, 18 Jul 2008) | 2 lines
Correct attribute name.
........
r65099 | georg.brandl | 2008-07-18 13:15:06 +0200 (Fri, 18 Jul 2008) | 3 lines
Document the different meaning of precision for {:f} and {:g}.
Also document how inf and nan are formatted. #3404.
........
r65127 | raymond.hettinger | 2008-07-19 02:42:03 +0200 (Sat, 19 Jul 2008) | 1 line
Improve accuracy of gamma test function
........
r65128 | raymond.hettinger | 2008-07-19 02:43:00 +0200 (Sat, 19 Jul 2008) | 1 line
Add recipe to the itertools docs.
........
r65131 | georg.brandl | 2008-07-19 12:08:55 +0200 (Sat, 19 Jul 2008) | 2 lines
#3378: in case of no memory, don't leak even more memory. :)
........
r65133 | georg.brandl | 2008-07-19 14:39:10 +0200 (Sat, 19 Jul 2008) | 3 lines
#3302: fix segfaults when passing None for arguments that can't
be NULL for the C functions.
........
r65134 | georg.brandl | 2008-07-19 14:46:12 +0200 (Sat, 19 Jul 2008) | 2 lines
#3303: fix crash with invalid Py_DECREF in strcoll().
........
r65135 | georg.brandl | 2008-07-19 15:00:22 +0200 (Sat, 19 Jul 2008) | 3 lines
#3319: don't raise ZeroDivisionError if number of rounds is so
low that benchtime is zero.
........
r65136 | georg.brandl | 2008-07-19 15:09:42 +0200 (Sat, 19 Jul 2008) | 3 lines
#3323: mention that if inheriting from a class without __slots__,
the subclass will have a __dict__ available too.
........
r65139 | georg.brandl | 2008-07-19 15:48:44 +0200 (Sat, 19 Jul 2008) | 2 lines
Add ordering info for findall and finditer.
........
r65149 | raymond.hettinger | 2008-07-20 01:21:57 +0200 (Sun, 20 Jul 2008) | 1 line
Fix compress() recipe in docs to use itertools.
........
r65150 | raymond.hettinger | 2008-07-20 01:58:47 +0200 (Sun, 20 Jul 2008) | 1 line
Clean-up itertools docs and recipes.
........
r65151 | gregory.p.smith | 2008-07-20 02:22:08 +0200 (Sun, 20 Jul 2008) | 9 lines
fix issue3120 - don't truncate handles on 64-bit Windows.
This is still messy, realistically PC/_subprocess.c should never cast pointers
to python numbers and back at all.
I don't have a 64-bit windows build environment because microsoft apparently
thinks that should cost money. Time to watch the buildbots. It builds and
passes tests on 32-bit windows.
........
r65155 | georg.brandl | 2008-07-20 13:50:29 +0200 (Sun, 20 Jul 2008) | 2 lines
#926501: add info where to put the docstring.
........
r65158 | neal.norwitz | 2008-07-20 21:35:23 +0200 (Sun, 20 Jul 2008) | 1 line
Fix a couple of names in error messages that were wrong
........
r65159 | neal.norwitz | 2008-07-20 22:39:36 +0200 (Sun, 20 Jul 2008) | 1 line
Fix misspeeld method name (negative)
........
r65176 | amaury.forgeotdarc | 2008-07-21 23:36:24 +0200 (Mon, 21 Jul 2008) | 4 lines
Increment version number in NEWS file, and move items that were added after 2.6b2.
(I thought there was a script to automate this kind of updates)
........
r65177 | amaury.forgeotdarc | 2008-07-22 00:00:38 +0200 (Tue, 22 Jul 2008) | 5 lines
Issue2378: pdb would delete free variables when stepping into a class statement.
The problem was introduced by r53954, the correction is to restore the symmetry between
PyFrame_FastToLocals and PyFrame_LocalsToFast
........
r65178 | benjamin.peterson | 2008-07-22 00:05:34 +0200 (Tue, 22 Jul 2008) | 1 line
don't use assert statement
........
r65183 | ronald.oussoren | 2008-07-22 09:06:00 +0200 (Tue, 22 Jul 2008) | 2 lines
Fix buglet in fix for issue3381
........
r65184 | ronald.oussoren | 2008-07-22 09:06:33 +0200 (Tue, 22 Jul 2008) | 2 lines
Fix build issue on OSX 10.4, somehow this wasn't committed before.
........
r65187 | raymond.hettinger | 2008-07-22 20:54:02 +0200 (Tue, 22 Jul 2008) | 1 line
Remove out-of-date section on Exact/Inexact.
........
r65188 | raymond.hettinger | 2008-07-22 21:00:47 +0200 (Tue, 22 Jul 2008) | 1 line
Tuples now have both count() and index().
........
r65189 | raymond.hettinger | 2008-07-22 21:03:05 +0200 (Tue, 22 Jul 2008) | 1 line
Fix credits for math.sum()
........
r65190 | raymond.hettinger | 2008-07-22 21:18:50 +0200 (Tue, 22 Jul 2008) | 1 line
One more attribution.
........
r65192 | benjamin.peterson | 2008-07-23 01:44:37 +0200 (Wed, 23 Jul 2008) | 1 line
remove unneeded import
........
r65194 | benjamin.peterson | 2008-07-23 15:25:06 +0200 (Wed, 23 Jul 2008) | 1 line
use isinstance
........
2008-07-23 13:10:53 -03:00
|
|
|
rollover interval.
|
Merged revisions 63829-63831,63858,63865,63879,63882,63948,63970-63972,63976,63989,64014-64015,64021-64022,64063-64065,64067 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r63829 | mark.summerfield | 2008-05-31 15:05:34 +0200 (Sat, 31 May 2008) | 4 lines
Added a note to [] that special forms & special chars lose their meaning
and backrefs can't be used inside []
........
r63830 | georg.brandl | 2008-05-31 16:40:09 +0200 (Sat, 31 May 2008) | 2 lines
#3010: clarification about stdin/use_rawinput.
........
r63831 | georg.brandl | 2008-05-31 16:45:55 +0200 (Sat, 31 May 2008) | 2 lines
#3005: add explaining sentence to easydialogs docs.
........
r63858 | georg.brandl | 2008-06-01 18:41:31 +0200 (Sun, 01 Jun 2008) | 2 lines
Add plain text make target.
........
r63865 | georg.brandl | 2008-06-01 21:24:36 +0200 (Sun, 01 Jun 2008) | 2 lines
Spaces vs. tabs.
........
r63879 | gregory.p.smith | 2008-06-02 00:57:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Make the _H #define's match the header file names. Fix comments to
mention the correct type names.
........
r63882 | gregory.p.smith | 2008-06-02 01:48:47 +0200 (Mon, 02 Jun 2008) | 3 lines
Adds a Thread.getIdent() method to provide the _get_ident() value for
any given threading.Thread object. feature request issue 2871.
........
r63948 | alexandre.vassalotti | 2008-06-04 22:41:44 +0200 (Wed, 04 Jun 2008) | 2 lines
Fixed complex.__getnewargs__() to not emit another complex object.
........
r63970 | andrew.kuchling | 2008-06-06 01:33:54 +0200 (Fri, 06 Jun 2008) | 1 line
Document 'utc' parameter
........
r63971 | andrew.kuchling | 2008-06-06 01:35:31 +0200 (Fri, 06 Jun 2008) | 1 line
Add various items
........
r63972 | andrew.kuchling | 2008-06-06 01:35:48 +0200 (Fri, 06 Jun 2008) | 1 line
Grammar fix
........
r63976 | georg.brandl | 2008-06-06 09:34:50 +0200 (Fri, 06 Jun 2008) | 2 lines
Markup fix.
........
r63989 | thomas.heller | 2008-06-06 20:42:11 +0200 (Fri, 06 Jun 2008) | 2 lines
Add a reminder for the maintainer of whatsnew.
........
r64014 | georg.brandl | 2008-06-07 17:59:10 +0200 (Sat, 07 Jun 2008) | 3 lines
Factor out docstring dedenting from inspect.getdoc() into inspect.cleandoc()
to ease standalone use of the algorithm.
........
r64015 | georg.brandl | 2008-06-07 18:04:01 +0200 (Sat, 07 Jun 2008) | 2 lines
Revert unwanted changes.
........
r64021 | georg.brandl | 2008-06-07 20:16:12 +0200 (Sat, 07 Jun 2008) | 2 lines
X-ref to numbers module.
........
r64022 | georg.brandl | 2008-06-07 20:17:37 +0200 (Sat, 07 Jun 2008) | 3 lines
Document the "st" API, to avoid confusion with the "new" AST.
Add a note about using the new AST module.
........
r64063 | martin.v.loewis | 2008-06-10 07:03:35 +0200 (Tue, 10 Jun 2008) | 2 lines
Add Gregor Lingl.
........
r64064 | georg.brandl | 2008-06-10 09:45:28 +0200 (Tue, 10 Jun 2008) | 2 lines
Add the "ast" module, containing helpers to ease use of the "_ast" classes.
........
r64065 | raymond.hettinger | 2008-06-10 09:57:15 +0200 (Tue, 10 Jun 2008) | 1 line
Add Arnaud for his efforts on multi-arg set operations.
........
r64067 | georg.brandl | 2008-06-10 14:46:39 +0200 (Tue, 10 Jun 2008) | 2 lines
#2536: fix itertools.permutations and itertools.combinations docstrings.
........
2008-06-10 13:37:50 -03:00
|
|
|
If the *utc* argument is true, times in UTC will be used; otherwise
|
|
|
|
local time is used.
|
|
|
|
|
|
|
|
If *backupCount* is nonzero, at most *backupCount* files
|
Merged revisions 62090-62091,62096,62100,62102,62110-62114 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r62090 | brett.cannon | 2008-04-01 07:37:43 -0500 (Tue, 01 Apr 2008) | 3 lines
Generalize test.test_support.test_stdout() with a base context manager so that
it is easy to capture stderr if desired.
........
r62091 | brett.cannon | 2008-04-01 07:46:02 -0500 (Tue, 01 Apr 2008) | 3 lines
Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot
of effort to do so.
........
r62096 | amaury.forgeotdarc | 2008-04-01 17:52:48 -0500 (Tue, 01 Apr 2008) | 4 lines
Newly enabled test appears to leak:
it registers the same codec on each iteration.
Do it only once at load time.
........
r62100 | amaury.forgeotdarc | 2008-04-01 19:55:04 -0500 (Tue, 01 Apr 2008) | 4 lines
A DocTestSuite cannot run multiple times: it clears its globals dictionary after the first run.
Rebuild the DocTestSuite on each iteration.
........
r62102 | jeffrey.yasskin | 2008-04-01 23:07:44 -0500 (Tue, 01 Apr 2008) | 3 lines
Try to make test_signal less flaky. I still see some flakiness in
test_itimer_prof.
........
r62110 | vinay.sajip | 2008-04-02 16:09:27 -0500 (Wed, 02 Apr 2008) | 1 line
Fix: #2315, #2316, #2317: TimedRotatingFileHandler - changed logic to better handle daylight savings time, deletion of old log files, and fixed a bug in calculating rollover when no logging occurs for a longer interval than the rollover period.
........
r62111 | vinay.sajip | 2008-04-02 16:10:23 -0500 (Wed, 02 Apr 2008) | 1 line
Added updates with respect to recent changes to TimedRotatingFileHandler.
........
r62112 | vinay.sajip | 2008-04-02 16:17:25 -0500 (Wed, 02 Apr 2008) | 1 line
Added updates with respect to recent changes to TimedRotatingFileHandler.
........
r62113 | amaury.forgeotdarc | 2008-04-02 16:18:46 -0500 (Wed, 02 Apr 2008) | 2 lines
Remove debug prints; the buildbot now passes the tests
........
r62114 | benjamin.peterson | 2008-04-02 16:20:35 -0500 (Wed, 02 Apr 2008) | 2 lines
Suggested proposed changes to Python be considered on some mailing lists first
........
2008-04-02 18:49:44 -03:00
|
|
|
will be kept, and if more would be created when rollover occurs, the oldest
|
|
|
|
one is deleted. The deletion logic uses the interval to determine which
|
|
|
|
files to delete, so changing the interval may leave old files lying around.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: doRollover()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Does a rollover, as described above.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Outputs the record to the file, catering for rollover as described above.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
SocketHandler
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`SocketHandler` class, located in the :mod:`logging.handlers` module,
|
|
|
|
sends logging output to a network socket. The base class uses a TCP socket.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: SocketHandler(host, port)
|
|
|
|
|
|
|
|
Returns a new instance of the :class:`SocketHandler` class intended to
|
|
|
|
communicate with a remote machine whose address is given by *host* and *port*.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: close()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Closes the socket.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Pickles the record's attribute dictionary and writes it to the socket in
|
|
|
|
binary format. If there is an error with the socket, silently drops the
|
|
|
|
packet. If the connection was previously lost, re-establishes the
|
|
|
|
connection. To unpickle the record at the receiving end into a
|
|
|
|
:class:`LogRecord`, use the :func:`makeLogRecord` function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: handleError()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Handles an error which has occurred during :meth:`emit`. The most likely
|
|
|
|
cause is a lost connection. Closes the socket so that we can retry on the
|
|
|
|
next event.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: makeSocket()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
This is a factory method which allows subclasses to define the precise
|
|
|
|
type of socket they want. The default implementation creates a TCP socket
|
|
|
|
(:const:`socket.SOCK_STREAM`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: makePickle(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Pickles the record's attribute dictionary in binary format with a length
|
|
|
|
prefix, and returns it ready for transmission across the socket.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: send(packet)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Send a pickled string *packet* to the socket. This function allows for
|
|
|
|
partial sends which can happen when the network is busy.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
DatagramHandler
|
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`DatagramHandler` class, located in the :mod:`logging.handlers`
|
|
|
|
module, inherits from :class:`SocketHandler` to support sending logging messages
|
|
|
|
over UDP sockets.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: DatagramHandler(host, port)
|
|
|
|
|
|
|
|
Returns a new instance of the :class:`DatagramHandler` class intended to
|
|
|
|
communicate with a remote machine whose address is given by *host* and *port*.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Pickles the record's attribute dictionary and writes it to the socket in
|
|
|
|
binary format. If there is an error with the socket, silently drops the
|
|
|
|
packet. To unpickle the record at the receiving end into a
|
|
|
|
:class:`LogRecord`, use the :func:`makeLogRecord` function.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: makeSocket()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
The factory method of :class:`SocketHandler` is here overridden to create
|
|
|
|
a UDP socket (:const:`socket.SOCK_DGRAM`).
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: send(s)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Send a pickled string to a socket.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
SysLogHandler
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`SysLogHandler` class, located in the :mod:`logging.handlers` module,
|
|
|
|
supports sending logging messages to a remote or local Unix syslog.
|
|
|
|
|
|
|
|
|
2009-10-10 17:32:36 -03:00
|
|
|
.. class:: SysLogHandler(address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER, socktype=socket.SOCK_DGRAM)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`SysLogHandler` class intended to
|
|
|
|
communicate with a remote Unix machine whose address is given by *address* in
|
|
|
|
the form of a ``(host, port)`` tuple. If *address* is not specified,
|
2009-10-10 17:32:36 -03:00
|
|
|
``('localhost', 514)`` is used. The address is used to open a socket. An
|
2007-08-15 11:28:22 -03:00
|
|
|
alternative to providing a ``(host, port)`` tuple is providing an address as a
|
|
|
|
string, for example "/dev/log". In this case, a Unix domain socket is used to
|
|
|
|
send the message to the syslog. If *facility* is not specified,
|
2009-10-10 17:32:36 -03:00
|
|
|
:const:`LOG_USER` is used. The type of socket opened depends on the
|
|
|
|
*socktype* argument, which defaults to :const:`socket.SOCK_DGRAM` and thus
|
|
|
|
opens a UDP socket. To open a TCP socket (for use with the newer syslog
|
|
|
|
daemons such as rsyslog), specify a value of :const:`socket.SOCK_STREAM`.
|
|
|
|
|
|
|
|
.. versionchanged:: 3.2
|
|
|
|
*socktype* was added.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: close()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Closes the socket to the remote host.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
The record is formatted, and then sent to the syslog server. If exception
|
|
|
|
information is present, it is *not* sent to the server.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: encodePriority(facility, priority)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Encodes the facility and priority into an integer. You can pass in strings
|
|
|
|
or integers - if strings are passed, internal mapping dictionaries are
|
|
|
|
used to convert them to integers.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
NTEventLogHandler
|
|
|
|
^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`NTEventLogHandler` class, located in the :mod:`logging.handlers`
|
|
|
|
module, supports sending logging messages to a local Windows NT, Windows 2000 or
|
|
|
|
Windows XP event log. Before you can use it, you need Mark Hammond's Win32
|
|
|
|
extensions for Python installed.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: NTEventLogHandler(appname, dllname=None, logtype='Application')
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`NTEventLogHandler` class. The *appname* is
|
|
|
|
used to define the application name as it appears in the event log. An
|
|
|
|
appropriate registry entry is created using this name. The *dllname* should give
|
|
|
|
the fully qualified pathname of a .dll or .exe which contains message
|
|
|
|
definitions to hold in the log (if not specified, ``'win32service.pyd'`` is used
|
|
|
|
- this is installed with the Win32 extensions and contains some basic
|
|
|
|
placeholder message definitions. Note that use of these placeholders will make
|
|
|
|
your event logs big, as the entire message source is held in the log. If you
|
|
|
|
want slimmer logs, you have to pass in the name of your own .dll or .exe which
|
|
|
|
contains the message definitions you want to use in the event log). The
|
|
|
|
*logtype* is one of ``'Application'``, ``'System'`` or ``'Security'``, and
|
|
|
|
defaults to ``'Application'``.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: close()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
At this point, you can remove the application name from the registry as a
|
|
|
|
source of event log entries. However, if you do this, you will not be able
|
|
|
|
to see the events as you intended in the Event Log Viewer - it needs to be
|
|
|
|
able to access the registry to get the .dll name. The current version does
|
Merged revisions 66045,66048-66049,66053,66060,66062-66063,66065,66067,66071-66074,66080,66082-66083,66090-66093,66097-66099,66103,66105,66110,66118 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r66045 | andrew.kuchling | 2008-08-26 19:27:18 -0500 (Tue, 26 Aug 2008) | 1 line
Trim whitespace; add a few updates
........
r66048 | andrew.kuchling | 2008-08-26 19:45:02 -0500 (Tue, 26 Aug 2008) | 1 line
Add an item and a note
........
r66049 | andrew.kuchling | 2008-08-26 21:12:18 -0500 (Tue, 26 Aug 2008) | 1 line
Add various items
........
r66053 | georg.brandl | 2008-08-28 04:40:18 -0500 (Thu, 28 Aug 2008) | 2 lines
#3711: .dll isn't a valid Python extension anymore.
........
r66060 | armin.rigo | 2008-08-29 16:21:52 -0500 (Fri, 29 Aug 2008) | 3 lines
A collection of crashers, all variants of the idea
of issue #3720.
........
r66062 | georg.brandl | 2008-08-30 04:49:36 -0500 (Sat, 30 Aug 2008) | 2 lines
#3730: mention "server" attribute explicitly.
........
r66063 | georg.brandl | 2008-08-30 04:52:44 -0500 (Sat, 30 Aug 2008) | 2 lines
#3716: fix typo.
........
r66065 | georg.brandl | 2008-08-30 05:03:09 -0500 (Sat, 30 Aug 2008) | 2 lines
#3569: eval() also accepts "exec"able code objects.
........
r66067 | georg.brandl | 2008-08-30 08:17:39 -0500 (Sat, 30 Aug 2008) | 2 lines
super() actually returns a super object.
........
r66071 | andrew.kuchling | 2008-08-30 10:19:57 -0500 (Sat, 30 Aug 2008) | 1 line
Partial edits from revision and tidying pass
........
r66072 | andrew.kuchling | 2008-08-30 10:21:23 -0500 (Sat, 30 Aug 2008) | 1 line
Tidy up some sentences
........
r66073 | andrew.kuchling | 2008-08-30 10:25:47 -0500 (Sat, 30 Aug 2008) | 1 line
Correction from Antoine Pitrou: BufferedWriter and Reader support seek()
........
r66074 | andrew.kuchling | 2008-08-30 11:44:54 -0500 (Sat, 30 Aug 2008) | 1 line
Edit four more sections
........
r66080 | georg.brandl | 2008-08-30 17:00:28 -0500 (Sat, 30 Aug 2008) | 2 lines
Fix markup.
........
r66082 | andrew.kuchling | 2008-08-30 17:56:54 -0500 (Sat, 30 Aug 2008) | 1 line
More edits; markup fixes
........
r66083 | andrew.kuchling | 2008-08-30 21:24:08 -0500 (Sat, 30 Aug 2008) | 1 line
More edits
........
r66090 | andrew.kuchling | 2008-08-31 09:29:31 -0500 (Sun, 31 Aug 2008) | 1 line
Edit the library section, rearranging items to flow better and making lots of edits
........
r66091 | andrew.kuchling | 2008-08-31 10:41:48 -0500 (Sun, 31 Aug 2008) | 1 line
Last batch of edits; remove the 'other changes' section
........
r66092 | andrew.kuchling | 2008-08-31 10:48:44 -0500 (Sun, 31 Aug 2008) | 1 line
Update patch/bug count
........
r66093 | gregory.p.smith | 2008-08-31 11:34:18 -0500 (Sun, 31 Aug 2008) | 3 lines
issue3715: docstring representation of hex escaped string needs to be double
escaped.
........
r66097 | benjamin.peterson | 2008-09-01 09:13:43 -0500 (Mon, 01 Sep 2008) | 4 lines
#3703 unhelpful _fileio.FileIO error message when trying to open a directory
Reviewer: Gregory P. Smith
........
r66098 | georg.brandl | 2008-09-01 09:15:55 -0500 (Mon, 01 Sep 2008) | 2 lines
#3749: fix c'n'p errors.
........
r66099 | benjamin.peterson | 2008-09-01 09:18:30 -0500 (Mon, 01 Sep 2008) | 4 lines
Fix compilation when --without-threads is given #3683
Reviewer: Georg Brandl, Benjamin Peterson
........
r66103 | vinay.sajip | 2008-09-01 09:30:10 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66105 | vinay.sajip | 2008-09-01 09:33:59 -0500 (Mon, 01 Sep 2008) | 1 line
logging: fixed lack of use of encoding attribute specified on a stream.
........
r66110 | vinay.sajip | 2008-09-01 10:08:07 -0500 (Mon, 01 Sep 2008) | 1 line
Added section about configuring logging in a library. Thanks to Thomas Heller for the idea.
........
r66118 | vinay.sajip | 2008-09-01 12:44:14 -0500 (Mon, 01 Sep 2008) | 1 line
Bug #3738: Documentation is now more accurate in describing handler close methods.
........
2008-09-01 21:31:15 -03:00
|
|
|
not do this.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Determines the message ID, event category and event type, and then logs
|
|
|
|
the message in the NT event log.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: getEventCategory(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Returns the event category for the record. Override this if you want to
|
|
|
|
specify your own categories. This version returns 0.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: getEventType(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Returns the event type for the record. Override this if you want to
|
|
|
|
specify your own types. This version does a mapping using the handler's
|
|
|
|
typemap attribute, which is set up in :meth:`__init__` to a dictionary
|
|
|
|
which contains mappings for :const:`DEBUG`, :const:`INFO`,
|
|
|
|
:const:`WARNING`, :const:`ERROR` and :const:`CRITICAL`. If you are using
|
|
|
|
your own levels, you will either need to override this method or place a
|
|
|
|
suitable dictionary in the handler's *typemap* attribute.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: getMessageID(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Returns the message ID for the record. If you are using your own messages,
|
|
|
|
you could do this by having the *msg* passed to the logger being an ID
|
|
|
|
rather than a format string. Then, in here, you could use a dictionary
|
|
|
|
lookup to get the message ID. This version returns 1, which is the base
|
|
|
|
message ID in :file:`win32service.pyd`.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
SMTPHandler
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`SMTPHandler` class, located in the :mod:`logging.handlers` module,
|
|
|
|
supports sending logging messages to an email address via SMTP.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: SMTPHandler(mailhost, fromaddr, toaddrs, subject, credentials=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`SMTPHandler` class. The instance is
|
|
|
|
initialized with the from and to addresses and subject line of the email. The
|
|
|
|
*toaddrs* should be a list of strings. To specify a non-standard SMTP port, use
|
|
|
|
the (host, port) tuple format for the *mailhost* argument. If you use a string,
|
|
|
|
the standard SMTP port is used. If your SMTP server requires authentication, you
|
|
|
|
can specify a (username, password) tuple for the *credentials* argument.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Formats the record and sends it to the specified addressees.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: getSubject(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
If you want to specify a subject line which is record-dependent, override
|
|
|
|
this method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
MemoryHandler
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`MemoryHandler` class, located in the :mod:`logging.handlers` module,
|
|
|
|
supports buffering of logging records in memory, periodically flushing them to a
|
|
|
|
:dfn:`target` handler. Flushing occurs whenever the buffer is full, or when an
|
|
|
|
event of a certain severity or greater is seen.
|
|
|
|
|
|
|
|
:class:`MemoryHandler` is a subclass of the more general
|
|
|
|
:class:`BufferingHandler`, which is an abstract class. This buffers logging
|
|
|
|
records in memory. Whenever each record is added to the buffer, a check is made
|
|
|
|
by calling :meth:`shouldFlush` to see if the buffer should be flushed. If it
|
|
|
|
should, then :meth:`flush` is expected to do the needful.
|
|
|
|
|
|
|
|
|
|
|
|
.. class:: BufferingHandler(capacity)
|
|
|
|
|
|
|
|
Initializes the handler with a buffer of the specified capacity.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Appends the record to the buffer. If :meth:`shouldFlush` returns true,
|
|
|
|
calls :meth:`flush` to process the buffer.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: flush()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
You can override this to implement custom flushing behavior. This version
|
|
|
|
just zaps the buffer to empty.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: shouldFlush(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Returns true if the buffer is up to capacity. This method can be
|
|
|
|
overridden to implement custom flushing strategies.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: MemoryHandler(capacity, flushLevel=ERROR, target=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`MemoryHandler` class. The instance is
|
|
|
|
initialized with a buffer size of *capacity*. If *flushLevel* is not specified,
|
|
|
|
:const:`ERROR` is used. If no *target* is specified, the target will need to be
|
|
|
|
set using :meth:`setTarget` before this handler does anything useful.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: close()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Calls :meth:`flush`, sets the target to :const:`None` and clears the
|
|
|
|
buffer.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: flush()
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
For a :class:`MemoryHandler`, flushing means just sending the buffered
|
|
|
|
records to the target, if there is one. Override if you want different
|
|
|
|
behavior.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: setTarget(target)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Sets the target handler for this handler.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: shouldFlush(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Checks for buffer full or a record at the *flushLevel* or higher.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
HTTPHandler
|
|
|
|
^^^^^^^^^^^
|
|
|
|
|
|
|
|
The :class:`HTTPHandler` class, located in the :mod:`logging.handlers` module,
|
|
|
|
supports sending logging messages to a Web server, using either ``GET`` or
|
|
|
|
``POST`` semantics.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: HTTPHandler(host, url, method='GET')
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns a new instance of the :class:`HTTPHandler` class. The instance is
|
|
|
|
initialized with a host address, url and HTTP method. The *host* can be of the
|
|
|
|
form ``host:port``, should you need to use a specific port number. If no
|
|
|
|
*method* is specified, ``GET`` is used.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: emit(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Sends the record to the Web server as an URL-encoded dictionary.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2007-12-04 15:30:01 -04:00
|
|
|
.. _formatter-objects:
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
Formatter Objects
|
|
|
|
-----------------
|
|
|
|
|
Merged revisions 68116-68119,68121,68123-68127 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r68116 | georg.brandl | 2009-01-01 05:46:51 -0600 (Thu, 01 Jan 2009) | 2 lines
#4100: note that element children are not necessarily present on "start" events.
........
r68117 | georg.brandl | 2009-01-01 05:53:55 -0600 (Thu, 01 Jan 2009) | 2 lines
#4156: make clear that "protocol" is to be replaced with the protocol name.
........
r68118 | georg.brandl | 2009-01-01 06:00:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4185: clarify escape behavior of replacement strings.
........
r68119 | georg.brandl | 2009-01-01 06:09:40 -0600 (Thu, 01 Jan 2009) | 3 lines
#4222: document dis.findlabels() and dis.findlinestarts() and
put them into dis.__all__.
........
r68121 | georg.brandl | 2009-01-01 06:43:33 -0600 (Thu, 01 Jan 2009) | 2 lines
Point to types module in new module deprecation notice.
........
r68123 | georg.brandl | 2009-01-01 06:52:29 -0600 (Thu, 01 Jan 2009) | 2 lines
#4784: ... on three counts ...
........
r68124 | georg.brandl | 2009-01-01 06:53:19 -0600 (Thu, 01 Jan 2009) | 2 lines
#4782: Fix markup error that hid load() and loads().
........
r68125 | georg.brandl | 2009-01-01 07:02:09 -0600 (Thu, 01 Jan 2009) | 2 lines
#4776: add data_files and package_dir arguments.
........
r68126 | georg.brandl | 2009-01-01 07:05:13 -0600 (Thu, 01 Jan 2009) | 2 lines
Handlers are in the `logging.handlers` module.
........
r68127 | georg.brandl | 2009-01-01 07:14:49 -0600 (Thu, 01 Jan 2009) | 2 lines
#4767: Use correct submodules for all MIME classes.
........
2009-01-01 11:05:06 -04:00
|
|
|
.. currentmodule:: logging
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
:class:`Formatter`\ s have the following attributes and methods. They are
|
|
|
|
responsible for converting a :class:`LogRecord` to (usually) a string which can
|
|
|
|
be interpreted by either a human or an external system. The base
|
|
|
|
:class:`Formatter` allows a formatting string to be specified. If none is
|
|
|
|
supplied, the default value of ``'%(message)s'`` is used.
|
|
|
|
|
|
|
|
A Formatter can be initialized with a format string which makes use of knowledge
|
|
|
|
of the :class:`LogRecord` attributes - such as the default value mentioned above
|
|
|
|
making use of the fact that the user's message and arguments are pre-formatted
|
|
|
|
into a :class:`LogRecord`'s *message* attribute. This format string contains
|
2009-12-19 19:26:38 -04:00
|
|
|
standard Python %-style mapping keys. See section :ref:`old-string-formatting`
|
2007-08-15 11:28:22 -03:00
|
|
|
for more information on string formatting.
|
|
|
|
|
|
|
|
Currently, the useful mapping keys in a :class:`LogRecord` are:
|
|
|
|
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| Format | Description |
|
|
|
|
+=========================+===============================================+
|
|
|
|
| ``%(name)s`` | Name of the logger (logging channel). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(levelno)s`` | Numeric logging level for the message |
|
|
|
|
| | (:const:`DEBUG`, :const:`INFO`, |
|
|
|
|
| | :const:`WARNING`, :const:`ERROR`, |
|
|
|
|
| | :const:`CRITICAL`). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(levelname)s`` | Text logging level for the message |
|
|
|
|
| | (``'DEBUG'``, ``'INFO'``, ``'WARNING'``, |
|
|
|
|
| | ``'ERROR'``, ``'CRITICAL'``). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(pathname)s`` | Full pathname of the source file where the |
|
|
|
|
| | logging call was issued (if available). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(filename)s`` | Filename portion of pathname. |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(module)s`` | Module (name portion of filename). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(funcName)s`` | Name of function containing the logging call. |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(lineno)d`` | Source line number where the logging call was |
|
|
|
|
| | issued (if available). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(created)f`` | Time when the :class:`LogRecord` was created |
|
|
|
|
| | (as returned by :func:`time.time`). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(relativeCreated)d`` | Time in milliseconds when the LogRecord was |
|
|
|
|
| | created, relative to the time the logging |
|
|
|
|
| | module was loaded. |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(asctime)s`` | Human-readable time when the |
|
|
|
|
| | :class:`LogRecord` was created. By default |
|
|
|
|
| | this is of the form "2003-07-08 16:49:45,896" |
|
|
|
|
| | (the numbers after the comma are millisecond |
|
|
|
|
| | portion of the time). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(msecs)d`` | Millisecond portion of the time when the |
|
|
|
|
| | :class:`LogRecord` was created. |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(thread)d`` | Thread ID (if available). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(threadName)s`` | Thread name (if available). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(process)d`` | Process ID (if available). |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
| ``%(message)s`` | The logged message, computed as ``msg % |
|
|
|
|
| | args``. |
|
|
|
|
+-------------------------+-----------------------------------------------+
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: Formatter(fmt=None, datefmt=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
Returns a new instance of the :class:`Formatter` class. The instance is
|
|
|
|
initialized with a format string for the message as a whole, as well as a
|
|
|
|
format string for the date/time portion of a message. If no *fmt* is
|
|
|
|
specified, ``'%(message)s'`` is used. If no *datefmt* is specified, the
|
|
|
|
ISO8601 date format is used.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: format(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
The record's attribute dictionary is used as the operand to a string
|
|
|
|
formatting operation. Returns the resulting string. Before formatting the
|
|
|
|
dictionary, a couple of preparatory steps are carried out. The *message*
|
|
|
|
attribute of the record is computed using *msg* % *args*. If the
|
|
|
|
formatting string contains ``'(asctime)'``, :meth:`formatTime` is called
|
|
|
|
to format the event time. If there is exception information, it is
|
|
|
|
formatted using :meth:`formatException` and appended to the message. Note
|
|
|
|
that the formatted exception information is cached in attribute
|
|
|
|
*exc_text*. This is useful because the exception information can be
|
|
|
|
pickled and sent across the wire, but you should be careful if you have
|
|
|
|
more than one :class:`Formatter` subclass which customizes the formatting
|
|
|
|
of exception information. In this case, you will have to clear the cached
|
|
|
|
value after a formatter has done its formatting, so that the next
|
|
|
|
formatter to handle the event doesn't use the cached value but
|
|
|
|
recalculates it afresh.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. method:: formatTime(record, datefmt=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
This method should be called from :meth:`format` by a formatter which
|
|
|
|
wants to make use of a formatted time. This method can be overridden in
|
|
|
|
formatters to provide for any specific requirement, but the basic behavior
|
|
|
|
is as follows: if *datefmt* (a string) is specified, it is used with
|
|
|
|
:func:`time.strftime` to format the creation time of the
|
|
|
|
record. Otherwise, the ISO8601 format is used. The resulting string is
|
|
|
|
returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: formatException(exc_info)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Formats the specified exception information (a standard exception tuple as
|
|
|
|
returned by :func:`sys.exc_info`) as a string. This default implementation
|
|
|
|
just uses :func:`traceback.print_exception`. The resulting string is
|
|
|
|
returned.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
Filter Objects
|
|
|
|
--------------
|
|
|
|
|
|
|
|
:class:`Filter`\ s can be used by :class:`Handler`\ s and :class:`Logger`\ s for
|
|
|
|
more sophisticated filtering than is provided by levels. The base filter class
|
|
|
|
only allows events which are below a certain point in the logger hierarchy. For
|
|
|
|
example, a filter initialized with "A.B" will allow events logged by loggers
|
|
|
|
"A.B", "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
|
|
|
|
initialized with the empty string, all events are passed.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: Filter(name='')
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns an instance of the :class:`Filter` class. If *name* is specified, it
|
|
|
|
names a logger which, together with its children, will have its events allowed
|
2009-06-08 06:13:45 -03:00
|
|
|
through the filter. If *name* is the empty string, allows every event.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: filter(record)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Is the specified record to be logged? Returns zero for no, nonzero for
|
|
|
|
yes. If deemed appropriate, the record may be modified in-place by this
|
|
|
|
method.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
LogRecord Objects
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
:class:`LogRecord` instances are created every time something is logged. They
|
|
|
|
contain all the information pertinent to the event being logged. The main
|
|
|
|
information passed in is in msg and args, which are combined using msg % args to
|
|
|
|
create the message field of the record. The record also includes information
|
|
|
|
such as when the record was created, the source line where the logging call was
|
|
|
|
made, and any exception information to be logged.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. class:: LogRecord(name, lvl, pathname, lineno, msg, args, exc_info, func=None)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Returns an instance of :class:`LogRecord` initialized with interesting
|
|
|
|
information. The *name* is the logger name; *lvl* is the numeric level;
|
|
|
|
*pathname* is the absolute pathname of the source file in which the logging
|
|
|
|
call was made; *lineno* is the line number in that file where the logging
|
|
|
|
call is found; *msg* is the user-supplied message (a format string); *args*
|
|
|
|
is the tuple which, together with *msg*, makes up the user message; and
|
|
|
|
*exc_info* is the exception tuple obtained by calling :func:`sys.exc_info`
|
|
|
|
(or :const:`None`, if no exception information is available). The *func* is
|
|
|
|
the name of the function from which the logging call was made. If not
|
|
|
|
specified, it defaults to ``None``.
|
|
|
|
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: getMessage()
|
|
|
|
|
|
|
|
Returns the message for this :class:`LogRecord` instance after merging any
|
|
|
|
user-supplied arguments with the message.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
2008-01-18 14:40:46 -04:00
|
|
|
LoggerAdapter Objects
|
|
|
|
---------------------
|
|
|
|
|
|
|
|
:class:`LoggerAdapter` instances are used to conveniently pass contextual
|
Merged revisions 60151-60159,60161-60168,60170,60172-60173,60175 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r60151 | christian.heimes | 2008-01-21 14:11:15 +0100 (Mon, 21 Jan 2008) | 1 line
A bunch of header files were not listed as dependencies for object files. Changes to files like Parser/parser.h weren't picked up by make.
........
r60152 | georg.brandl | 2008-01-21 15:16:46 +0100 (Mon, 21 Jan 2008) | 3 lines
#1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
........
r60153 | georg.brandl | 2008-01-21 15:18:14 +0100 (Mon, 21 Jan 2008) | 2 lines
mmap is an extension module.
........
r60154 | georg.brandl | 2008-01-21 17:28:13 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix example.
........
r60155 | georg.brandl | 2008-01-21 17:34:07 +0100 (Mon, 21 Jan 2008) | 2 lines
#1555501: document plistlib and move it to the general library.
........
r60156 | georg.brandl | 2008-01-21 17:36:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Add a stub for bundlebuilder documentation.
........
r60157 | georg.brandl | 2008-01-21 17:46:58 +0100 (Mon, 21 Jan 2008) | 2 lines
Removing bundlebuilder docs again -- it's not to be used anymore (see #779825).
........
r60158 | georg.brandl | 2008-01-21 17:51:51 +0100 (Mon, 21 Jan 2008) | 2 lines
#997912: acknowledge nested scopes in tutorial.
........
r60159 | vinay.sajip | 2008-01-21 18:02:26 +0100 (Mon, 21 Jan 2008) | 1 line
Fix: #1836: Off-by-one bug in TimedRotatingFileHandler rollover calculation. Patch thanks to Kathryn M. Kowalski.
........
r60161 | georg.brandl | 2008-01-21 18:13:03 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt pydoc to new doc URLs.
........
r60162 | georg.brandl | 2008-01-21 18:17:00 +0100 (Mon, 21 Jan 2008) | 2 lines
Fix old link.
........
r60163 | georg.brandl | 2008-01-21 18:22:06 +0100 (Mon, 21 Jan 2008) | 2 lines
#1726198: replace while 1: fp.readline() with file iteration.
........
r60164 | georg.brandl | 2008-01-21 18:29:23 +0100 (Mon, 21 Jan 2008) | 2 lines
Clarify $ behavior in re docstring. #1631394.
........
r60165 | vinay.sajip | 2008-01-21 18:39:22 +0100 (Mon, 21 Jan 2008) | 1 line
Minor documentation change - hyperlink tidied up.
........
r60166 | georg.brandl | 2008-01-21 18:42:40 +0100 (Mon, 21 Jan 2008) | 2 lines
#1530959: change distutils build dir for --with-pydebug python builds.
........
r60167 | vinay.sajip | 2008-01-21 19:16:05 +0100 (Mon, 21 Jan 2008) | 1 line
Updated to include news on recent logging fixes and documentation changes.
........
r60168 | georg.brandl | 2008-01-21 19:35:49 +0100 (Mon, 21 Jan 2008) | 3 lines
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly.
........
r60170 | georg.brandl | 2008-01-21 19:36:51 +0100 (Mon, 21 Jan 2008) | 2 lines
Add NEWS entry for #1882.
........
r60172 | georg.brandl | 2008-01-21 19:41:24 +0100 (Mon, 21 Jan 2008) | 2 lines
Use original location of document, which has translations.
........
r60173 | walter.doerwald | 2008-01-21 21:18:04 +0100 (Mon, 21 Jan 2008) | 2 lines
Follow PEP 8 in module docstring.
........
r60175 | georg.brandl | 2008-01-21 21:20:53 +0100 (Mon, 21 Jan 2008) | 2 lines
Adapt to latest doctools refactoring.
........
2008-01-21 16:36:10 -04:00
|
|
|
information into logging calls. For a usage example , see the section on
|
|
|
|
`adding contextual information to your logging output`__.
|
|
|
|
|
|
|
|
__ context-info_
|
2008-01-18 14:40:46 -04:00
|
|
|
|
|
|
|
.. class:: LoggerAdapter(logger, extra)
|
|
|
|
|
|
|
|
Returns an instance of :class:`LoggerAdapter` initialized with an
|
|
|
|
underlying :class:`Logger` instance and a dict-like object.
|
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
.. method:: process(msg, kwargs)
|
2008-01-18 14:40:46 -04:00
|
|
|
|
2008-04-24 22:59:09 -03:00
|
|
|
Modifies the message and/or keyword arguments passed to a logging call in
|
|
|
|
order to insert contextual information. This implementation takes the object
|
|
|
|
passed as *extra* to the constructor and adds it to *kwargs* using key
|
|
|
|
'extra'. The return value is a (*msg*, *kwargs*) tuple which has the
|
|
|
|
(possibly modified) versions of the arguments passed in.
|
2008-01-18 14:40:46 -04:00
|
|
|
|
|
|
|
In addition to the above, :class:`LoggerAdapter` supports all the logging
|
|
|
|
methods of :class:`Logger`, i.e. :meth:`debug`, :meth:`info`, :meth:`warning`,
|
|
|
|
:meth:`error`, :meth:`exception`, :meth:`critical` and :meth:`log`. These
|
|
|
|
methods have the same signatures as their counterparts in :class:`Logger`, so
|
|
|
|
you can use the two types of instances interchangeably.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Thread Safety
|
|
|
|
-------------
|
|
|
|
|
|
|
|
The logging module is intended to be thread-safe without any special work
|
|
|
|
needing to be done by its clients. It achieves this though using threading
|
|
|
|
locks; there is one lock to serialize access to the module's shared data, and
|
|
|
|
each handler also creates a lock to serialize access to its underlying I/O.
|
|
|
|
|
Merged revisions 70712,70714,70764-70765,70769-70771,70773,70776-70777,70788-70789,70824,70828,70832,70836,70842,70851,70855,70857,70866-70872,70883,70885,70893-70894,70896-70897,70903,70905-70907,70915,70927,70933,70951,70960,70962-70964,70998,71001,71006,71008,71010-71011,71019,71037,71056,71094,71101-71103,71106,71119,71123,71149-71150,71203,71212,71214-71217,71221,71240 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r70712 | benjamin.peterson | 2009-03-30 10:15:38 -0500 (Mon, 30 Mar 2009) | 1 line
don't rely on the order dict repr #5605
........
r70714 | brett.cannon | 2009-03-30 10:20:53 -0500 (Mon, 30 Mar 2009) | 1 line
Add an entry to developers.txt.
........
r70764 | martin.v.loewis | 2009-03-30 17:06:33 -0500 (Mon, 30 Mar 2009) | 2 lines
Add several VM developers.
........
r70765 | georg.brandl | 2009-03-30 17:09:34 -0500 (Mon, 30 Mar 2009) | 1 line
#5199: make warning about vars() assignment more visible.
........
r70769 | andrew.kuchling | 2009-03-30 17:29:53 -0500 (Mon, 30 Mar 2009) | 1 line
Remove comment
........
r70770 | andrew.kuchling | 2009-03-30 17:30:20 -0500 (Mon, 30 Mar 2009) | 1 line
Add several items and placeholders
........
r70771 | andrew.kuchling | 2009-03-30 17:31:11 -0500 (Mon, 30 Mar 2009) | 1 line
Many edits
........
r70773 | georg.brandl | 2009-03-30 17:43:00 -0500 (Mon, 30 Mar 2009) | 1 line
#5039: make it clear that the impl. note refers to CPython.
........
r70776 | andrew.kuchling | 2009-03-30 18:08:24 -0500 (Mon, 30 Mar 2009) | 1 line
typo fix
........
r70777 | andrew.kuchling | 2009-03-30 18:09:46 -0500 (Mon, 30 Mar 2009) | 1 line
Add more items
........
r70788 | andrew.kuchling | 2009-03-30 20:21:01 -0500 (Mon, 30 Mar 2009) | 1 line
Add various items
........
r70789 | georg.brandl | 2009-03-30 20:25:15 -0500 (Mon, 30 Mar 2009) | 1 line
Fix a wrong struct field assignment (docstring as closure).
........
r70824 | georg.brandl | 2009-03-31 10:43:20 -0500 (Tue, 31 Mar 2009) | 1 line
#5519: remove reference to Kodos, which seems dead.
........
r70828 | georg.brandl | 2009-03-31 10:50:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5581: fget argument of abstractproperty is optional as well.
........
r70832 | georg.brandl | 2009-03-31 11:31:11 -0500 (Tue, 31 Mar 2009) | 1 line
#1386675: specify WindowsError as the exception, because it has a winerror attribute that EnvironmentError doesnt have.
........
r70836 | georg.brandl | 2009-03-31 11:50:25 -0500 (Tue, 31 Mar 2009) | 1 line
#5417: replace references to undocumented functions by ones to documented functions.
........
r70842 | georg.brandl | 2009-03-31 12:13:06 -0500 (Tue, 31 Mar 2009) | 1 line
#970783: document PyObject_Generic[GS]etAttr.
........
r70851 | georg.brandl | 2009-03-31 13:26:55 -0500 (Tue, 31 Mar 2009) | 1 line
#837577: note cryptic return value of spawn*e on invalid env dicts.
........
r70855 | georg.brandl | 2009-03-31 13:30:37 -0500 (Tue, 31 Mar 2009) | 1 line
#5245: note that PyRun_SimpleString doesnt return on SystemExit.
........
r70857 | georg.brandl | 2009-03-31 13:33:10 -0500 (Tue, 31 Mar 2009) | 1 line
#5227: note that Py_Main doesnt return on SystemExit.
........
r70866 | georg.brandl | 2009-03-31 14:06:57 -0500 (Tue, 31 Mar 2009) | 1 line
#4882: document named group behavior a bit better.
........
r70867 | georg.brandl | 2009-03-31 14:10:35 -0500 (Tue, 31 Mar 2009) | 1 line
#1096310: document usage of sys.__std*__ a bit better.
........
r70868 | georg.brandl | 2009-03-31 14:12:17 -0500 (Tue, 31 Mar 2009) | 1 line
#5190: export make_option in __all__.
........
r70869 | georg.brandl | 2009-03-31 14:14:42 -0500 (Tue, 31 Mar 2009) | 1 line
Fix-up unwanted change.
........
r70870 | georg.brandl | 2009-03-31 14:26:24 -0500 (Tue, 31 Mar 2009) | 1 line
#4411: document mro() and __mro__. (I hope I got it right.)
........
r70871 | georg.brandl | 2009-03-31 14:30:56 -0500 (Tue, 31 Mar 2009) | 1 line
#5618: fix typo.
........
r70872 | r.david.murray | 2009-03-31 14:31:17 -0500 (Tue, 31 Mar 2009) | 3 lines
Delete out-of-date and little-known README from the test
directory by consensus of devs at pycon sprint.
........
r70883 | georg.brandl | 2009-03-31 15:41:08 -0500 (Tue, 31 Mar 2009) | 1 line
#1674032: return value of flag from Event.wait(). OKed by Guido.
........
r70885 | tarek.ziade | 2009-03-31 15:48:31 -0500 (Tue, 31 Mar 2009) | 1 line
using log.warn for sys.stderr
........
r70893 | georg.brandl | 2009-03-31 15:56:32 -0500 (Tue, 31 Mar 2009) | 1 line
#1530012: move TQS section before raw strings.
........
r70894 | benjamin.peterson | 2009-03-31 16:06:30 -0500 (Tue, 31 Mar 2009) | 1 line
take the usual lock precautions around _active_limbo_lock
........
r70896 | georg.brandl | 2009-03-31 16:15:33 -0500 (Tue, 31 Mar 2009) | 1 line
#5598: document DocFileSuite *args argument.
........
r70897 | benjamin.peterson | 2009-03-31 16:34:42 -0500 (Tue, 31 Mar 2009) | 1 line
fix Thread.ident when it is the main thread or a dummy thread #5632
........
r70903 | georg.brandl | 2009-03-31 16:45:18 -0500 (Tue, 31 Mar 2009) | 1 line
#1676135: remove trailing slashes from --prefix argument.
........
r70905 | georg.brandl | 2009-03-31 17:03:40 -0500 (Tue, 31 Mar 2009) | 1 line
#5563: more documentation for bdist_msi.
........
r70906 | georg.brandl | 2009-03-31 17:11:53 -0500 (Tue, 31 Mar 2009) | 1 line
#1651995: fix _convert_ref for non-ASCII characters.
........
r70907 | georg.brandl | 2009-03-31 17:18:19 -0500 (Tue, 31 Mar 2009) | 1 line
#3427: document correct return type for urlopen().info().
........
r70915 | georg.brandl | 2009-03-31 17:40:16 -0500 (Tue, 31 Mar 2009) | 1 line
#5018: remove confusing paragraph.
........
r70927 | georg.brandl | 2009-03-31 18:01:27 -0500 (Tue, 31 Mar 2009) | 1 line
Dont shout to users.
........
r70933 | georg.brandl | 2009-03-31 19:04:33 -0500 (Tue, 31 Mar 2009) | 2 lines
Issue #5635: Fix running test_sys with tracing enabled.
........
r70951 | georg.brandl | 2009-04-01 09:02:27 -0500 (Wed, 01 Apr 2009) | 1 line
Add Maksim, who worked on several issues at the sprint.
........
r70960 | jesse.noller | 2009-04-01 11:42:19 -0500 (Wed, 01 Apr 2009) | 1 line
Issue 3270: document Listener address restrictions on windows
........
r70962 | brett.cannon | 2009-04-01 12:07:16 -0500 (Wed, 01 Apr 2009) | 2 lines
Ron DuPlain was given commit privileges at PyCon 2009 to work on 3to2.
........
r70963 | georg.brandl | 2009-04-01 12:46:01 -0500 (Wed, 01 Apr 2009) | 1 line
#5655: fix docstring oversight.
........
r70964 | brett.cannon | 2009-04-01 12:52:13 -0500 (Wed, 01 Apr 2009) | 2 lines
Paul Kippes was given commit privileges to work on 3to2.
........
r70998 | georg.brandl | 2009-04-01 16:54:21 -0500 (Wed, 01 Apr 2009) | 1 line
In Pdb, stop assigning values to __builtin__._ which interferes with the one commonly installed by gettext.
........
r71001 | brett.cannon | 2009-04-01 18:01:12 -0500 (Wed, 01 Apr 2009) | 3 lines
Add my initials to Misc/developers.txt. Names are now sorted by number of
characters in the person's name.
........
r71006 | georg.brandl | 2009-04-01 18:32:17 -0500 (Wed, 01 Apr 2009) | 1 line
Cache the f_locals dict of the current frame, since every access to frame.f_locals overrides its contents with the real locals which undoes modifications made by the debugging user.
........
r71008 | andrew.kuchling | 2009-04-01 19:02:14 -0500 (Wed, 01 Apr 2009) | 1 line
Typo fix
........
r71010 | benjamin.peterson | 2009-04-01 19:11:52 -0500 (Wed, 01 Apr 2009) | 1 line
fix markup
........
r71011 | benjamin.peterson | 2009-04-01 19:12:47 -0500 (Wed, 01 Apr 2009) | 1 line
this should be :noindex:
........
r71019 | georg.brandl | 2009-04-01 21:00:01 -0500 (Wed, 01 Apr 2009) | 1 line
Fix test_doctest, missed two assignments to curframe.
........
r71037 | r.david.murray | 2009-04-01 23:34:04 -0500 (Wed, 01 Apr 2009) | 6 lines
Clarify that datetime strftime does not produce leap seconds and datetime
strptime does not accept it in the strftime behavior section of the
datetime docs.
Closes issue 2568.
........
r71056 | georg.brandl | 2009-04-02 12:43:07 -0500 (Thu, 02 Apr 2009) | 2 lines
Actually the displayhook should print the repr.
........
r71094 | vinay.sajip | 2009-04-03 05:23:18 -0500 (Fri, 03 Apr 2009) | 1 line
Added warning about logging use from asynchronous signal handlers.
........
r71101 | andrew.kuchling | 2009-04-03 16:43:00 -0500 (Fri, 03 Apr 2009) | 1 line
Add some items
........
r71102 | andrew.kuchling | 2009-04-03 16:44:49 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the'; grammar fix
........
r71103 | andrew.kuchling | 2009-04-03 16:45:29 -0500 (Fri, 03 Apr 2009) | 1 line
Fix 'the the' duplication
........
r71106 | vinay.sajip | 2009-04-03 16:58:16 -0500 (Fri, 03 Apr 2009) | 1 line
Clarified warning about logging use from asynchronous signal handlers.
........
r71119 | raymond.hettinger | 2009-04-04 00:37:47 -0500 (Sat, 04 Apr 2009) | 1 line
Add helpful link.
........
r71123 | r.david.murray | 2009-04-04 01:39:56 -0500 (Sat, 04 Apr 2009) | 2 lines
Fix error in description of 'oct' (issue 5678).
........
r71149 | georg.brandl | 2009-04-04 08:42:39 -0500 (Sat, 04 Apr 2009) | 1 line
#5642: clarify map() compatibility to the builtin.
........
r71150 | georg.brandl | 2009-04-04 08:45:49 -0500 (Sat, 04 Apr 2009) | 1 line
#5601: clarify that webbrowser is not meant for file names.
........
r71203 | benjamin.peterson | 2009-04-04 18:46:34 -0500 (Sat, 04 Apr 2009) | 1 line
note how using iter* are unsafe while mutating and document iter(dict)
........
r71212 | georg.brandl | 2009-04-05 05:24:20 -0500 (Sun, 05 Apr 2009) | 1 line
#1742837: expand HTTP server docs, and fix SocketServer ones to document methods as methods, not functions.
........
r71214 | georg.brandl | 2009-04-05 05:29:57 -0500 (Sun, 05 Apr 2009) | 1 line
Normalize spelling of Mac OS X.
........
r71215 | georg.brandl | 2009-04-05 05:32:26 -0500 (Sun, 05 Apr 2009) | 1 line
Avoid sure signs of a diseased mind.
........
r71216 | georg.brandl | 2009-04-05 05:41:02 -0500 (Sun, 05 Apr 2009) | 1 line
#1718017: document the relation of os.path and the posixpath, ntpath etc. modules better.
........
r71217 | georg.brandl | 2009-04-05 05:48:47 -0500 (Sun, 05 Apr 2009) | 1 line
#1726172: dont raise an unexpected IndexError if a voidresp() call has an empty response.
........
r71221 | vinay.sajip | 2009-04-05 06:06:24 -0500 (Sun, 05 Apr 2009) | 1 line
Issue #5695: Moved logging.captureWarnings() call inside with statement in WarningsTest.test_warnings.
........
r71240 | georg.brandl | 2009-04-05 09:40:06 -0500 (Sun, 05 Apr 2009) | 1 line
#5370: doc update about unpickling objects with custom __getattr__ etc. methods.
........
2009-04-05 16:13:16 -03:00
|
|
|
If you are implementing asynchronous signal handlers using the :mod:`signal`
|
|
|
|
module, you may not be able to use logging from within such handlers. This is
|
|
|
|
because lock implementations in the :mod:`threading` module are not always
|
|
|
|
re-entrant, and so cannot be invoked from such signal handlers.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Configuration
|
|
|
|
-------------
|
|
|
|
|
|
|
|
|
|
|
|
.. _logging-config-api:
|
|
|
|
|
|
|
|
Configuration functions
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
The following functions configure the logging module. They are located in the
|
|
|
|
:mod:`logging.config` module. Their use is optional --- you can configure the
|
|
|
|
logging module using these functions or by making calls to the main API (defined
|
|
|
|
in :mod:`logging` itself) and defining handlers which are declared either in
|
|
|
|
:mod:`logging` or :mod:`logging.handlers`.
|
|
|
|
|
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2008-05-14 19:59:42 -03:00
|
|
|
Reads the logging configuration from a :mod:`configparser`\-format file named
|
2009-01-09 00:11:44 -04:00
|
|
|
*fname*. This function can be called several times from an application,
|
2008-05-14 19:59:42 -03:00
|
|
|
allowing an end user the ability to select from various pre-canned
|
|
|
|
configurations (if the developer provides a mechanism to present the choices
|
|
|
|
and load the chosen configuration). Defaults to be passed to the ConfigParser
|
|
|
|
can be specified in the *defaults* argument.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
If *disable_existing_loggers* is true, any existing loggers that are not
|
|
|
|
children of named loggers will be disabled.
|
|
|
|
|
2007-08-15 11:28:22 -03:00
|
|
|
|
2009-06-08 06:13:45 -03:00
|
|
|
.. function:: listen(port=DEFAULT_LOGGING_CONFIG_PORT)
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Starts up a socket server on the specified port, and listens for new
|
|
|
|
configurations. If no port is specified, the module's default
|
|
|
|
:const:`DEFAULT_LOGGING_CONFIG_PORT` is used. Logging configurations will be
|
|
|
|
sent as a file suitable for processing by :func:`fileConfig`. Returns a
|
|
|
|
:class:`Thread` instance on which you can call :meth:`start` to start the
|
|
|
|
server, and which you can :meth:`join` when appropriate. To stop the server,
|
2007-12-04 15:30:01 -04:00
|
|
|
call :func:`stopListening`.
|
|
|
|
|
|
|
|
To send a configuration to the socket, read in the configuration file and
|
|
|
|
send it to the socket as a string of bytes preceded by a four-byte length
|
|
|
|
string packed in binary using ``struct.pack('>L', n)``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
|
|
|
|
.. function:: stopListening()
|
|
|
|
|
2007-12-04 15:30:01 -04:00
|
|
|
Stops the listening server which was created with a call to :func:`listen`.
|
|
|
|
This is typically called before calling :meth:`join` on the return value from
|
2007-08-15 11:28:22 -03:00
|
|
|
:func:`listen`.
|
|
|
|
|
|
|
|
|
|
|
|
.. _logging-config-fileformat:
|
|
|
|
|
|
|
|
Configuration file format
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2009-01-09 00:11:44 -04:00
|
|
|
The configuration file format understood by :func:`fileConfig` is based on
|
|
|
|
:mod:`configparser` functionality. The file must contain sections called
|
|
|
|
``[loggers]``, ``[handlers]`` and ``[formatters]`` which identify by name the
|
|
|
|
entities of each type which are defined in the file. For each such entity, there
|
|
|
|
is a separate section which identifies how that entity is configured. Thus, for
|
|
|
|
a logger named ``log01`` in the ``[loggers]`` section, the relevant
|
|
|
|
configuration details are held in a section ``[logger_log01]``. Similarly, a
|
|
|
|
handler called ``hand01`` in the ``[handlers]`` section will have its
|
|
|
|
configuration held in a section called ``[handler_hand01]``, while a formatter
|
|
|
|
called ``form01`` in the ``[formatters]`` section will have its configuration
|
|
|
|
specified in a section called ``[formatter_form01]``. The root logger
|
|
|
|
configuration must be specified in a section called ``[logger_root]``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
Examples of these sections in the file are given below. ::
|
|
|
|
|
|
|
|
[loggers]
|
|
|
|
keys=root,log02,log03,log04,log05,log06,log07
|
|
|
|
|
|
|
|
[handlers]
|
|
|
|
keys=hand01,hand02,hand03,hand04,hand05,hand06,hand07,hand08,hand09
|
|
|
|
|
|
|
|
[formatters]
|
|
|
|
keys=form01,form02,form03,form04,form05,form06,form07,form08,form09
|
|
|
|
|
|
|
|
The root logger must specify a level and a list of handlers. An example of a
|
|
|
|
root logger section is given below. ::
|
|
|
|
|
|
|
|
[logger_root]
|
|
|
|
level=NOTSET
|
|
|
|
handlers=hand01
|
|
|
|
|
|
|
|
The ``level`` entry can be one of ``DEBUG, INFO, WARNING, ERROR, CRITICAL`` or
|
|
|
|
``NOTSET``. For the root logger only, ``NOTSET`` means that all messages will be
|
|
|
|
logged. Level values are :func:`eval`\ uated in the context of the ``logging``
|
|
|
|
package's namespace.
|
|
|
|
|
|
|
|
The ``handlers`` entry is a comma-separated list of handler names, which must
|
|
|
|
appear in the ``[handlers]`` section. These names must appear in the
|
|
|
|
``[handlers]`` section and have corresponding sections in the configuration
|
|
|
|
file.
|
|
|
|
|
|
|
|
For loggers other than the root logger, some additional information is required.
|
|
|
|
This is illustrated by the following example. ::
|
|
|
|
|
|
|
|
[logger_parser]
|
|
|
|
level=DEBUG
|
|
|
|
handlers=hand01
|
|
|
|
propagate=1
|
|
|
|
qualname=compiler.parser
|
|
|
|
|
|
|
|
The ``level`` and ``handlers`` entries are interpreted as for the root logger,
|
|
|
|
except that if a non-root logger's level is specified as ``NOTSET``, the system
|
|
|
|
consults loggers higher up the hierarchy to determine the effective level of the
|
|
|
|
logger. The ``propagate`` entry is set to 1 to indicate that messages must
|
|
|
|
propagate to handlers higher up the logger hierarchy from this logger, or 0 to
|
|
|
|
indicate that messages are **not** propagated to handlers up the hierarchy. The
|
|
|
|
``qualname`` entry is the hierarchical channel name of the logger, that is to
|
|
|
|
say the name used by the application to get the logger.
|
|
|
|
|
|
|
|
Sections which specify handler configuration are exemplified by the following.
|
|
|
|
::
|
|
|
|
|
|
|
|
[handler_hand01]
|
|
|
|
class=StreamHandler
|
|
|
|
level=NOTSET
|
|
|
|
formatter=form01
|
|
|
|
args=(sys.stdout,)
|
|
|
|
|
|
|
|
The ``class`` entry indicates the handler's class (as determined by :func:`eval`
|
|
|
|
in the ``logging`` package's namespace). The ``level`` is interpreted as for
|
|
|
|
loggers, and ``NOTSET`` is taken to mean "log everything".
|
|
|
|
|
|
|
|
The ``formatter`` entry indicates the key name of the formatter for this
|
|
|
|
handler. If blank, a default formatter (``logging._defaultFormatter``) is used.
|
|
|
|
If a name is specified, it must appear in the ``[formatters]`` section and have
|
|
|
|
a corresponding section in the configuration file.
|
|
|
|
|
|
|
|
The ``args`` entry, when :func:`eval`\ uated in the context of the ``logging``
|
|
|
|
package's namespace, is the list of arguments to the constructor for the handler
|
|
|
|
class. Refer to the constructors for the relevant handlers, or to the examples
|
|
|
|
below, to see how typical entries are constructed. ::
|
|
|
|
|
|
|
|
[handler_hand02]
|
|
|
|
class=FileHandler
|
|
|
|
level=DEBUG
|
|
|
|
formatter=form02
|
|
|
|
args=('python.log', 'w')
|
|
|
|
|
|
|
|
[handler_hand03]
|
|
|
|
class=handlers.SocketHandler
|
|
|
|
level=INFO
|
|
|
|
formatter=form03
|
|
|
|
args=('localhost', handlers.DEFAULT_TCP_LOGGING_PORT)
|
|
|
|
|
|
|
|
[handler_hand04]
|
|
|
|
class=handlers.DatagramHandler
|
|
|
|
level=WARN
|
|
|
|
formatter=form04
|
|
|
|
args=('localhost', handlers.DEFAULT_UDP_LOGGING_PORT)
|
|
|
|
|
|
|
|
[handler_hand05]
|
|
|
|
class=handlers.SysLogHandler
|
|
|
|
level=ERROR
|
|
|
|
formatter=form05
|
|
|
|
args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
|
|
|
|
|
|
|
|
[handler_hand06]
|
|
|
|
class=handlers.NTEventLogHandler
|
|
|
|
level=CRITICAL
|
|
|
|
formatter=form06
|
|
|
|
args=('Python Application', '', 'Application')
|
|
|
|
|
|
|
|
[handler_hand07]
|
|
|
|
class=handlers.SMTPHandler
|
|
|
|
level=WARN
|
|
|
|
formatter=form07
|
|
|
|
args=('localhost', 'from@abc', ['user1@abc', 'user2@xyz'], 'Logger Subject')
|
|
|
|
|
|
|
|
[handler_hand08]
|
|
|
|
class=handlers.MemoryHandler
|
|
|
|
level=NOTSET
|
|
|
|
formatter=form08
|
|
|
|
target=
|
|
|
|
args=(10, ERROR)
|
|
|
|
|
|
|
|
[handler_hand09]
|
|
|
|
class=handlers.HTTPHandler
|
|
|
|
level=NOTSET
|
|
|
|
formatter=form09
|
|
|
|
args=('localhost:9022', '/log', 'GET')
|
|
|
|
|
|
|
|
Sections which specify formatter configuration are typified by the following. ::
|
|
|
|
|
|
|
|
[formatter_form01]
|
|
|
|
format=F1 %(asctime)s %(levelname)s %(message)s
|
|
|
|
datefmt=
|
|
|
|
class=logging.Formatter
|
|
|
|
|
|
|
|
The ``format`` entry is the overall format string, and the ``datefmt`` entry is
|
Merged revisions 59605-59624 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r59606 | georg.brandl | 2007-12-29 11:57:00 +0100 (Sat, 29 Dec 2007) | 2 lines
Some cleanup in the docs.
........
r59611 | martin.v.loewis | 2007-12-29 19:49:21 +0100 (Sat, 29 Dec 2007) | 2 lines
Bug #1699: Define _BSD_SOURCE only on OpenBSD.
........
r59612 | raymond.hettinger | 2007-12-29 23:09:34 +0100 (Sat, 29 Dec 2007) | 1 line
Simpler documentation for itertools.tee(). Should be backported.
........
r59613 | raymond.hettinger | 2007-12-29 23:16:24 +0100 (Sat, 29 Dec 2007) | 1 line
Improve docs for itertools.groupby(). The use of xrange(0) to create a unique object is less obvious than object().
........
r59620 | christian.heimes | 2007-12-31 15:47:07 +0100 (Mon, 31 Dec 2007) | 3 lines
Added wininst-9.0.exe executable for VS 2008
Integrated bdist_wininst into PCBuild9 directory
........
r59621 | christian.heimes | 2007-12-31 15:51:18 +0100 (Mon, 31 Dec 2007) | 1 line
Moved PCbuild directory to PC/VS7.1
........
r59622 | christian.heimes | 2007-12-31 15:59:26 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot
........
r59623 | christian.heimes | 2007-12-31 16:02:41 +0100 (Mon, 31 Dec 2007) | 1 line
Fix paths for build bot, part 2
........
r59624 | christian.heimes | 2007-12-31 16:18:55 +0100 (Mon, 31 Dec 2007) | 1 line
Renamed PCBuild9 directory to PCBuild
........
2007-12-31 12:14:33 -04:00
|
|
|
the :func:`strftime`\ -compatible date/time format string. If empty, the
|
|
|
|
package substitutes ISO8601 format date/times, which is almost equivalent to
|
|
|
|
specifying the date format string ``"%Y-%m-%d %H:%M:%S"``. The ISO8601 format
|
|
|
|
also specifies milliseconds, which are appended to the result of using the above
|
|
|
|
format string, with a comma separator. An example time in ISO8601 format is
|
|
|
|
``2003-01-23 00:29:50,411``.
|
2007-08-15 11:28:22 -03:00
|
|
|
|
|
|
|
The ``class`` entry is optional. It indicates the name of the formatter's class
|
|
|
|
(as a dotted module and class name.) This option is useful for instantiating a
|
|
|
|
:class:`Formatter` subclass. Subclasses of :class:`Formatter` can present
|
|
|
|
exception tracebacks in an expanded or condensed format.
|
|
|
|
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
Configuration server example
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Here is an example of a module using the logging configuration server::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import logging.config
|
|
|
|
import time
|
|
|
|
import os
|
|
|
|
|
|
|
|
# read initial config file
|
|
|
|
logging.config.fileConfig("logging.conf")
|
|
|
|
|
|
|
|
# create and start listener on port 9999
|
|
|
|
t = logging.config.listen(9999)
|
|
|
|
t.start()
|
|
|
|
|
|
|
|
logger = logging.getLogger("simpleExample")
|
|
|
|
|
|
|
|
try:
|
|
|
|
# loop through logging calls to see the difference
|
|
|
|
# new configurations make, until Ctrl+C is pressed
|
|
|
|
while True:
|
|
|
|
logger.debug("debug message")
|
|
|
|
logger.info("info message")
|
|
|
|
logger.warn("warn message")
|
|
|
|
logger.error("error message")
|
|
|
|
logger.critical("critical message")
|
|
|
|
time.sleep(5)
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
# cleanup
|
|
|
|
logging.config.stopListening()
|
|
|
|
t.join()
|
|
|
|
|
|
|
|
And here is a script that takes a filename and sends that file to the server,
|
|
|
|
properly preceded with the binary-encoded length, as the new logging
|
|
|
|
configuration::
|
|
|
|
|
|
|
|
#!/usr/bin/env python
|
|
|
|
import socket, sys, struct
|
|
|
|
|
|
|
|
data_to_send = open(sys.argv[1], "r").read()
|
|
|
|
|
|
|
|
HOST = 'localhost'
|
|
|
|
PORT = 9999
|
|
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
2008-02-01 07:56:49 -04:00
|
|
|
print("connecting...")
|
2007-12-04 15:30:01 -04:00
|
|
|
s.connect((HOST, PORT))
|
2008-02-01 07:56:49 -04:00
|
|
|
print("sending config...")
|
2007-12-04 15:30:01 -04:00
|
|
|
s.send(struct.pack(">L", len(data_to_send)))
|
|
|
|
s.send(data_to_send)
|
|
|
|
s.close()
|
2008-02-01 07:56:49 -04:00
|
|
|
print("complete")
|
2007-12-04 15:30:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
More examples
|
|
|
|
-------------
|
|
|
|
|
|
|
|
Multiple handlers and formatters
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Loggers are plain Python objects. The :func:`addHandler` method has no minimum
|
|
|
|
or maximum quota for the number of handlers you may add. Sometimes it will be
|
|
|
|
beneficial for an application to log all messages of all severities to a text
|
|
|
|
file while simultaneously logging errors or above to the console. To set this
|
|
|
|
up, simply configure the appropriate handlers. The logging calls in the
|
|
|
|
application code will remain unchanged. Here is a slight modification to the
|
|
|
|
previous simple module-based configuration example::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
logger = logging.getLogger("simple_example")
|
|
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
# create file handler which logs even debug messages
|
|
|
|
fh = logging.FileHandler("spam.log")
|
|
|
|
fh.setLevel(logging.DEBUG)
|
|
|
|
# create console handler with a higher log level
|
|
|
|
ch = logging.StreamHandler()
|
|
|
|
ch.setLevel(logging.ERROR)
|
|
|
|
# create formatter and add it to the handlers
|
|
|
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
|
|
|
ch.setFormatter(formatter)
|
|
|
|
fh.setFormatter(formatter)
|
|
|
|
# add the handlers to logger
|
|
|
|
logger.addHandler(ch)
|
|
|
|
logger.addHandler(fh)
|
|
|
|
|
|
|
|
# "application" code
|
|
|
|
logger.debug("debug message")
|
|
|
|
logger.info("info message")
|
|
|
|
logger.warn("warn message")
|
|
|
|
logger.error("error message")
|
|
|
|
logger.critical("critical message")
|
|
|
|
|
|
|
|
Notice that the "application" code does not care about multiple handlers. All
|
|
|
|
that changed was the addition and configuration of a new handler named *fh*.
|
|
|
|
|
|
|
|
The ability to create new handlers with higher- or lower-severity filters can be
|
|
|
|
very helpful when writing and testing an application. Instead of using many
|
|
|
|
``print`` statements for debugging, use ``logger.debug``: Unlike the print
|
|
|
|
statements, which you will have to delete or comment out later, the logger.debug
|
|
|
|
statements can remain intact in the source code and remain dormant until you
|
|
|
|
need them again. At that time, the only change that needs to happen is to
|
|
|
|
modify the severity level of the logger and/or handler to debug.
|
|
|
|
|
|
|
|
|
|
|
|
Using logging in multiple modules
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
It was mentioned above that multiple calls to
|
|
|
|
``logging.getLogger('someLogger')`` return a reference to the same logger
|
|
|
|
object. This is true not only within the same module, but also across modules
|
|
|
|
as long as it is in the same Python interpreter process. It is true for
|
|
|
|
references to the same object; additionally, application code can define and
|
|
|
|
configure a parent logger in one module and create (but not configure) a child
|
|
|
|
logger in a separate module, and all logger calls to the child will pass up to
|
|
|
|
the parent. Here is a main module::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
import auxiliary_module
|
|
|
|
|
|
|
|
# create logger with "spam_application"
|
|
|
|
logger = logging.getLogger("spam_application")
|
|
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
# create file handler which logs even debug messages
|
|
|
|
fh = logging.FileHandler("spam.log")
|
|
|
|
fh.setLevel(logging.DEBUG)
|
|
|
|
# create console handler with a higher log level
|
|
|
|
ch = logging.StreamHandler()
|
|
|
|
ch.setLevel(logging.ERROR)
|
|
|
|
# create formatter and add it to the handlers
|
|
|
|
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
|
|
|
|
fh.setFormatter(formatter)
|
|
|
|
ch.setFormatter(formatter)
|
|
|
|
# add the handlers to the logger
|
|
|
|
logger.addHandler(fh)
|
|
|
|
logger.addHandler(ch)
|
|
|
|
|
|
|
|
logger.info("creating an instance of auxiliary_module.Auxiliary")
|
|
|
|
a = auxiliary_module.Auxiliary()
|
|
|
|
logger.info("created an instance of auxiliary_module.Auxiliary")
|
|
|
|
logger.info("calling auxiliary_module.Auxiliary.do_something")
|
|
|
|
a.do_something()
|
|
|
|
logger.info("finished auxiliary_module.Auxiliary.do_something")
|
|
|
|
logger.info("calling auxiliary_module.some_function()")
|
|
|
|
auxiliary_module.some_function()
|
|
|
|
logger.info("done with auxiliary_module.some_function()")
|
|
|
|
|
|
|
|
Here is the auxiliary module::
|
|
|
|
|
|
|
|
import logging
|
|
|
|
|
|
|
|
# create logger
|
|
|
|
module_logger = logging.getLogger("spam_application.auxiliary")
|
|
|
|
|
|
|
|
class Auxiliary:
|
|
|
|
def __init__(self):
|
|
|
|
self.logger = logging.getLogger("spam_application.auxiliary.Auxiliary")
|
|
|
|
self.logger.info("creating an instance of Auxiliary")
|
|
|
|
def do_something(self):
|
|
|
|
self.logger.info("doing something")
|
|
|
|
a = 1 + 1
|
|
|
|
self.logger.info("done doing something")
|
|
|
|
|
|
|
|
def some_function():
|
|
|
|
module_logger.info("received a call to \"some_function\"")
|
|
|
|
|
|
|
|
The output looks like this::
|
|
|
|
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,663 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
creating an instance of auxiliary_module.Auxiliary
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,665 - spam_application.auxiliary.Auxiliary - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
creating an instance of Auxiliary
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,665 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
created an instance of auxiliary_module.Auxiliary
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,668 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
calling auxiliary_module.Auxiliary.do_something
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,668 - spam_application.auxiliary.Auxiliary - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
doing something
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,669 - spam_application.auxiliary.Auxiliary - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
done doing something
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,670 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
finished auxiliary_module.Auxiliary.do_something
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,671 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
calling auxiliary_module.some_function()
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,672 - spam_application.auxiliary - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
received a call to "some_function"
|
2008-01-07 13:19:16 -04:00
|
|
|
2005-03-23 23:47:11,673 - spam_application - INFO -
|
2007-12-04 15:30:01 -04:00
|
|
|
done with auxiliary_module.some_function()
|
|
|
|
|