Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

flask logging miguel grinberg

# ...
from logging.handlers import RotatingFileHandler
import os

# ...

if not app.debug:
    # ...

    if not os.path.exists('logs'):
        os.mkdir('logs')
    file_handler = RotatingFileHandler('logs/microblog.log', maxBytes=10240,
                                       backupCount=10)
    file_handler.setFormatter(logging.Formatter(
        '%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]'))
    file_handler.setLevel(logging.INFO)
    app.logger.addHandler(file_handler)

    app.logger.setLevel(logging.INFO)
    app.logger.info('Microblog startup')
Comment

PREVIOUS NEXT
Code Example
Python :: pyqt-opengl-drawing-simple-scenes 
Python :: python deque deep copy 
Python :: python empty list boolean 
Python :: Python Class Without Getters and Setters 
Python :: osmapi 
Python :: numpy addition operation using numpy functions 
Python :: pie plot chance size python 
Python :: Errors that you will get during date object in python datetime 
Python :: does xgboost accept pandas 
Python :: python check if ip is proxy or vpn or tor or relay 
Python :: multiKey dict error 
Python :: for loop python terminal 
Python :: Path 
Python :: rickroll on input IN PYTHON 
Python :: matplotlib no gui 
Python :: find anagrams of a string python 
Python :: if you have a list and the user input one of the keys then output its value 
Python :: python flask rest api upload image 
Python :: python sort by last name using lambda 
Python :: barplot hatch 
Python :: turtle screen close error fix 
Python :: how to have unlimited parameters in a function in python 
Python :: How to Use the abs() Function in Python? A Syntax Breakdown for Beginners 
Python :: py variable space padding 
Python :: hover 777-286 
Python :: run php websevrer with python 
Python :: email grabber python 
Python :: python vergleichsoperatoren 
Python :: python exit while loop 
Python :: django cms create page programmatically 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =