[mod_python] problems with logging

Camilo Telles camilot at terra.com.br
Sat Aug 16 07:37:44 EDT 2008


Graham,

How do I flush it? How I get access to the FileHandler from the logging object?
I prefer to use the logging module, so I can split the content to be logged between two files.

Camilo



---------- Cabeçalho original -----------

De: "Graham Dumpleton" graham.dumpleton at gmail.com
Para: "Camilo Telles" camilot at terra.com.br
Cópia: "mod_python" mod_python at modpython.org
Data: Sat, 16 Aug 2008 21:22:31 +1000
Assunto: Re: [mod_python] problems with logging

> The sys.stderr stream in mod_python is buffered, you need to flush it.
> You are better of implementing a logging module handler which logs
> using apache.log_error().
> 
> Graham
> 
> 2008/8/16 Camilo Telles <camilot at terra.com.br>:
> > Sirs,
> >
> > I have an annoying problem happening with mod_python and logging.
> > Here is the code:
> > ===========================================
> > import logging
> > from mod_python import util
> >
> > def index(req, email):
> >        logging.basicConfig(level=logging.DEBUG,
> >                    format='%(asctime)s;%(message)s',
> >                    filename='log_email.txt',
> >                    filemode='a')
> >        logging.info(email)
> >        logging.shutdown()
> >
> >        util.redirect(req, 'http://dummy/download.html')
> > ======================================
> >
> > What happens: sometimes the logs occurs, sometimes it not. It´s completely random.
> >
> > I´m using:
> >
> > Apache/2.2.8 (Ubuntu)
> > mod_python/3.3.1
> > Python/2.5.2
> >
> > Any clue? I need to do some kind of flush? If yes, how?
> >
> > Thanks in advance.
> >
> > Camilo
> >
> >
> >
> > _______________________________________________
> > Mod_python mailing list
> > Mod_python at modpython.org
> > http://mailman.modpython.org/mailman/listinfo/mod_python
> >
> 
> Esta mensagem foi verificada pelo E-mail Protegido Terra.
> Atualizado em 16/08/2008
> 
> 




More information about the Mod_python mailing list