librelist archives

« back to archive

Disabling stderr logging

Disabling stderr logging

From:
Anna Sirota
Date:
2013-09-04 @ 09:04
Hi everyone,

How to completely disable stderr output from Flask?
Flask app.logger isn't used anywhere in the app, only custom loggers 
fetch by logging.getLogger.
I've tried setting debug to False, disabling app.logger, and also 
setting logger_name:

         app.debug = False
         app.logger.disabled = True
         app.logger_name = 'custom_logger'

but app still redirects info and debug messages from any custom logger 
to stderr.
I've also noticed that regardless of app.debug there's a DebugHandler in 
app.logger.handlers which does not seem right.
Manually removing DebugHandler doesn't help either.
Am I missing something obvious is here?

Any suggestion would be quite welcome, thanks in advance

Re: [flask] Disabling stderr logging

From:
Joeri Belis
Date:
2013-09-04 @ 09:15
Did you try it as app.run parameter?
app.run(host='0.0.0.0', debug=False, use_reloader=False)


2013/9/4 Anna Sirota <dev.local@gmail.com>

> Hi everyone,
>
> How to completely disable stderr output from Flask?
> Flask app.logger isn't used anywhere in the app, only custom loggers
> fetch by logging.getLogger.
> I've tried setting debug to False, disabling app.logger, and also
> setting logger_name:
>
>          app.debug = False
>          app.logger.disabled = True
>          app.logger_name = 'custom_logger'
>
> but app still redirects info and debug messages from any custom logger
> to stderr.
> I've also noticed that regardless of app.debug there's a DebugHandler in
> app.logger.handlers which does not seem right.
> Manually removing DebugHandler doesn't help either.
> Am I missing something obvious is here?
>
> Any suggestion would be quite welcome, thanks in advance
>



-- 
** 15 september* - Het niet te missen *Natuurpuntfeest - *Kesterheide te
Gooik*
Voor programma en inschrijving: deze

link<http://www.natuurpunt.be/nl/doe-mee/campagnes-en-acties/natuurpunt-feest-voor-het-hele-gezin_3245.aspx>
.

Re: [flask] Disabling stderr logging

From:
Anna Sirota
Date:
2013-09-04 @ 09:33
Yes, debug=False in app.run disables stderr logging, but before the app 
is actually run some logging messages still written to stderr.
Also app is running under Gunicorn so calling app.run manually won't 
help much.

Is it possible to change logging setting in the same way as app.run(.. 
debug=False) does before run is called?

On 09/04/2013 01:15 PM, Joeri Belis wrote:
> Did you try it as app.run parameter?
> app.run(host='0.0.0.0', debug=False, use_reloader=False)
>
>
> 2013/9/4 Anna Sirota <dev.local@gmail.com <mailto:dev.local@gmail.com>>
>
>     Hi everyone,
>
>     How to completely disable stderr output from Flask?
>     Flask app.logger isn't used anywhere in the app, only custom loggers
>     fetch by logging.getLogger.
>     I've tried setting debug to False, disabling app.logger, and also
>     setting logger_name:
>
>              app.debug = False
>              app.logger.disabled = True
>              app.logger_name = 'custom_logger'
>
>     but app still redirects info and debug messages from any custom logger
>     to stderr.
>     I've also noticed that regardless of app.debug there's a
>     DebugHandler in
>     app.logger.handlers which does not seem right.
>     Manually removing DebugHandler doesn't help either.
>     Am I missing something obvious is here?
>
>     Any suggestion would be quite welcome, thanks in advance
>
>
>
>
> -- 
> ** 15 september* - Het niet te missen *Natuurpuntfeest - *Kesterheide 
> te Gooik*
> Voor programma en inschrijving: deze link 
> 
<http://www.natuurpunt.be/nl/doe-mee/campagnes-en-acties/natuurpunt-feest-voor-het-hele-gezin_3245.aspx>.

>

Re: [flask] Disabling stderr logging

From:
Anna Sirota
Date:
2013-09-04 @ 10:00
My bad, just found out there was another module setting up 
StreamHandler, sorry for irrelevant question, thanks for the answer!

On 09/04/2013 01:33 PM, Anna Sirota wrote:
> Yes, debug=False in app.run disables stderr logging, but before the 
> app is actually run some logging messages still written to stderr.
> Also app is running under Gunicorn so calling app.run manually won't 
> help much.
>
> Is it possible to change logging setting in the same way as app.run(.. 
> debug=False) does before run is called?
>
> On 09/04/2013 01:15 PM, Joeri Belis wrote:
>> Did you try it as app.run parameter?
>> app.run(host='0.0.0.0', debug=False, use_reloader=False)
>>
>>
>> 2013/9/4 Anna Sirota <dev.local@gmail.com <mailto:dev.local@gmail.com>>
>>
>>     Hi everyone,
>>
>>     How to completely disable stderr output from Flask?
>>     Flask app.logger isn't used anywhere in the app, only custom loggers
>>     fetch by logging.getLogger.
>>     I've tried setting debug to False, disabling app.logger, and also
>>     setting logger_name:
>>
>>              app.debug = False
>>              app.logger.disabled = True
>>              app.logger_name = 'custom_logger'
>>
>>     but app still redirects info and debug messages from any custom 
>> logger
>>     to stderr.
>>     I've also noticed that regardless of app.debug there's a
>>     DebugHandler in
>>     app.logger.handlers which does not seem right.
>>     Manually removing DebugHandler doesn't help either.
>>     Am I missing something obvious is here?
>>
>>     Any suggestion would be quite welcome, thanks in advance
>>
>>
>>
>>
>> -- 
>> ** 15 september* - Het niet te missen *Natuurpuntfeest - *Kesterheide 
>> te Gooik*
>> Voor programma en inschrijving: deze link 
>> 
<http://www.natuurpunt.be/nl/doe-mee/campagnes-en-acties/natuurpunt-feest-voor-het-hele-gezin_3245.aspx>.

>>
>