Website, services for micro, log (log) is an important operation and maintenance tools. Django the log, mainly multiplexing Python standard library of the logging , the module settings.py
for configuration. In addition, it provides some unique extensions.
settings.py
TIME_ZONE = ' Asia / of Shanghai ' the LOGGING = { ' Version ' :. 1 , ' disable_existing_loggers ' : False, ' formatters ' : { # have this configuration in, without having to modify the system configuration ' verbose ' : { ' the format ' : ' { {} {} Module1 the asctime funcName} {lineno:. {3} levelname:. 7} => {Message} ' ,
# the asctime> 2018-11-15 Module1> is the module funcName> function name lineno: 3> displaying at least 3 characters ranging up space levelname> is the log level message>Log content is 'style': '{', }, }, 'handlers': { 'console': { 'class': 'logging.StreamHandler', 'formatter': 'verbose', }, 'file': { 'class': 'logging.handlers.RotatingFileHandler', 'formatter': 'verbose', 'filename': '/tmp/django.log', 'maxBytes': 4194304, # 4 MB 'backupCount': 10, 'level': 'DEBUG', }, }, 'loggers': { '': { 'handlers': ['console', 'file'], 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), }, 'django': { 'handlers': ['console', 'file'], 'level': os.getenv('DJANGO_LOG_LEVEL', 'INFO'), 'propagate': False, }, }, }