[Mailman-Developers] Logging issues on the trunk

Barry Warsaw barry at python.org
Wed Apr 26 19:39:06 CEST 2006


On Tue, 2006-04-25 at 14:46 -0700, Mark Sapiro wrote:
> There are a few remaining issues regarding logging in the svn trunk.
> 
> 1) The ReopenableFileHandler.__init__ method in Mailman/loginit.py
>    calls
> 
>          logging.FileHandler.__init__(self, filename, mode, encoding)
> 
>    This method only allows the instance, filename and mode arguments.
>    The encoding argument throws a TypeError exception.

Looks like that's a Python 2.3/2.4 compatibility issue.  Dang.  Okay,
I'll figure out a workaround for that.

> 2) The 'locks' log is missing from the LOGGERS tuple in loginit.py

Thanks, I'll add that.

> 3) Mailman/LogFile.py still references Mailman.Logging.StampedLogger
>    This is tricky if we want to maintain its current ability to be
>    used outside of Mailman.
> 
>    I *think* we could change
> 
>         try:
>             from Mailman.Logging.StampedLogger import StampedLogger
>             _logfile = StampedLogger('locks')
> 
>    to
> 
>         try:
>             from Mailman import loginit
>             _logfile = logging.getLogger('mailman.locks')
>             _logfile.write = _logfile.info
> 
>    where the import of loginit is just to see if it throws the
>    exception. I'm not sure if we ever need to actually call
> 
>             loginit.initialize()
> 
>    as in most if not all cases, this has already been done by some
>    superordinate importer of LogFile.

That sounds about right.  We might want to parameterize the actual
logger name at the top in case someone wants to change that.  OTOH, I'm
not aware of anybody else actually using the LockFile.py implementation
outside of Mailman.

> 4) Many of the scripts/* files contain
> 
>         from Mailman.Logging.Utils import LogStdErr
> 
>         and
> 
>             LogStdErr('error', 'name')
> 
> I think these can just be deleted as the scripts/driver script
> does the Mailman.loginit.initialize()

That sounds right too.  Thanks for finding these Mark -- I'll attack
those tonight.  I'm also working on a diff that will replace getopt with
optparse and will put the bulk of the bin/* and cron/* scripts as
modules under Mailman.bin.  There will be a symlink from bin/mmshell to
the individual scripts, and mmshell will look at sys.argv[0] to figure
out which module to run.  The nice thing about this is that we won't
have to re-run configure every time one of those command line scripts
change, but only if mmshell changes.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/mailman-developers/attachments/20060426/f7a27e3a/attachment.pgp 


More information about the Mailman-Developers mailing list