ANN: Logging Module v0.4.6 released 
Author Message
 ANN: Logging Module v0.4.6 released

A new version of the proposed python standard logging module (as per
PEP 282) has been released.

What Does It Do?
The logging module offers the ability for any Python program to log
events which occur during program execution. It's typically used to
provide application diagnostics, warnings and error messages. In
addition to capturing "what happened", "where it happened", "when it
happened", "how important it is" and event specific data, you can
configure, without changing the application source code, both the
verbosity of logging and the routing of events to different
destinations such as console, disk files, sockets, email addresses,
Web servers, SOAP servers etc. etc. You can even change the
configuration of a running program without stopping and restarting it!

You can use the logging module in exception handlers, and it will
include traceback information in the log. It's thread-safe, and very
easy to use - just "import logging" and log away! Classes provided

Logger  - used to log messages for a particular area of an application.
You can instantiate these wherever you want, there's no need to pass
references to them around your application. You can log events based
on importance levels of DEBUG (least important), INFO, WARN, ERROR,
and CRITICAL (most important). You can define your own levels if the
default levels don't meet your requirements.

Handler - used to route events to particular destinations. Handlers
included are:
   StreamHandler (for generalized streams, including console)
   FileHandler (for disk files - including log file rotation with size
limits for log files)
   SocketHandler (for sending events to a TCP socket)
   DatagramHandler (for sending events to a UDP socket - faster, but
less reliable than TCP)
   SMTPHandler (send events to arbitrary email addresses)
   HTTPHandler (send events to Web servers)
   SysLogHandler (send events to Unix syslog)
   MemoryHandler (batch up events and process them several at a time)
   NTEventLogHandler (send events to Windows NT event logs)

There are also examples of XMLHandler and SOAPHandler in the

Formatter - used to format events as text strings. Flexible "msg %
arg_tuple" formatting is the basis for formatting, with flexible
date/time formatting including ISO8601 and any strftime-based formats.

Filter - used when filtering based on importance
(DEBUG/INFO/WARN/ERROR/CRITICAL) is not sufficient. The distribution
includes examples of filters based on class matching, regular
expression matching, value matching, and logger matching.

In the unlikely event that you're daunted by all the apparent
complexity, fear not. The module offers a simple function-based
interface to allow very simple, almost casual use of the underlying

In addition to the core logging functionality, you get the ability to
configure logging using a ConfigParser-based text file format, a
Tkinter-based GUI configurator which creates configuration files for
you, and a simple network-based event receiver which receives events
on TCP, UDP, HTTP and SOAP ports. This is suitable for testing and
might perhaps serve as a model for your own event receivers. Also
included are over 20 test scripts which serve both as test harnesses
and examples of how to use the logging module.

You can get more information from


There are "download" and "recent changes" links at the top of that
page. The new stuff includes some bug fixes, better support for
class-based filtering and logging, more documentation of the
configuration file format, an example hand-coded configuration file
for those people who can't use the GUI configurator, an example Filter
for regular-expression match-based filtering, and more!

As always, your feedback is most welcome (especially bug reports,
patches and suggestions for improvement). Enjoy!


Vinay Sajip
Red Dove Consultants Ltd.

Changes since the last version:
Added raiseExceptions to allow conditional propagation of exceptions
which occur during handling.
Added converter to Formatter to allow use of any function to convert
time from seconds to a tuple.
It still defaults to time.localtime but now you can also use
time.gmtime. Added to test the conversion feature.
Changed rootlogger default level to WARN - was DEBUG.
Updated some docstrings.
Moved import of threading to where thread is imported. If either is
unavailable, threading support is off.
Updated minor defects in python_logging.html.
Check to see if ConfigParser has readfp method; if it does and an
object with a 'read' method is passed in, assumes a file-like object
and uses readfp to read it in.

Fri, 24 Dec 2004 08:37:55 GMT  
 [ 1 post ] 

 Relevant Pages 

1. ANN: Logging Module v0.4.5 released

2. ANN: Logging Module v0.4.4 released

3. ANN: Logging Module v0.4.3 released

4. ANN: Logging Module v0.4.2 released

5. ANN: Logging Module v0.4.1 released

6. ANN: Logging Module v0.4.4 released

7. ANN: Logging Module v0.4.3 released

8. ANN: Logging Module v0.4.2 released

9. ANN: Logging Module v0.4.1 released

10. ANN: Logging Module v0.4.6 released

11. ANN: Logging Module v0.4.5 released

12. ANN: Logging Module v0.4 released


Powered by phpBB® Forum Software