Error log when running wxPython

I have only read about it, but the new logging module in 2.3 sounds VERY
good. Here is a snippet of what it can "log" to:

* StreamHandler instances send error messages to streams (file-like
objects).

* FileHandler instances send error messages to disk files.

* RotatingFileHandler instances send error messages to disk files, with
support for maximum log file sizes and log file rotation.

* SocketHandler instances send error messages to TCP/IP sockets.

* DatagramHandler instances send error messages to UDP sockets.

* SMTPHandler instances send error messages to a designated email address.

* SysLogHandler instances send error messages to a Unix syslog daemon,
possibly on a remote machine.

* NTEventLogHandler instances send error messages to a Windows NT/2000/XP
event log.

* MemoryHandler instances send error messages to a buffer in memory, which
is flushed whenever specific criteria are met.

* HTTPHandler instances send error messages to an HTTP server using either
"GET" or "POST" semantics.

HTH,
jw

=->-----Original Message-----
=->From: Chris [mailto:rahl@mydt.org]
=->Sent: Wednesday, March 17, 2004 12:51 PM
=->To: wxPython-users@lists.wxwidgets.org
=->Subject: [wxPython-users] Error log when running wxPython
=->
=->
=->I've written a database front-end using Python 2.3.3 and
=->wxPython 2.4
=->for Windows.
=->
=->Normally any error messages would show up in the console
=->that ran the
=->program. However, I don't want my users to have to see a DOS
=->box, so I
=->use .pyw instead.
=->
=->Is there a preferred method to log any error messages that would
=->normally go to the DOS box?
=->
=->I would like to write them to file so I can review them later.
=->
=->Thanks,
=->Chris
=->
=->
=->---------------------------------------------------------------------
=->To unsubscribe, e-mail:
=->wxPython-users-unsubscribe@lists.wxwidgets.org
=->For additional commands, e-mail:
=->wxPython-users-help@lists.wxwidgets.org
=->
=->

Wyant, Jaime wrote:

I have only read about it, but the new logging module in 2.3 sounds VERY
good. Here is a snippet of what it can "log" to:

=->I've written a database front-end using Python 2.3.3 and =->wxPython 2.4 =->for Windows.
=->
=->Normally any error messages would show up in the console =->that ran the =->program. However, I don't want my users to have to see a DOS =->box, so I =->use .pyw instead.
=->
=->Is there a preferred method to log any error messages that would =->normally go to the DOS box?
=->
=->I would like to write them to file so I can review them later.

The initial setup is a bit cumbersome but if you do it right you only need to do it once, and it's as involved as it is because of its excellent flexibility, so I think it's well worth it.

I've managed to tie "logging" to wx with a litte work. Just create an object that has a 'read', 'write', 'close', and 'flush' method (and I think 'read' isn't needed'. Tie those methods to wx events, and make event handlers as appropriate - i.e. for 'write' you'd probably be taking the line of text and appending it to a wx.TextCtrl (which is what I was doing). Create an instance of this object, pass it to logging as a stream object, and you're in business. Plus you can use the same logging object to write to an actual file.

At some point I really should write this up on the wiki.