Django log output to start server in file

How to print logs that come from python manage.py runservera log file (instead of displaying inside the console).

This is an example of a log that I want to save in a log file:

Performing system checks... System check identified no issues (0 silenced). November 19, 2015 - 01:37:54 Django version 1.8.5, using settings 'simpatize.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.

+4
source share
1 answer

Write the log to a file log.txtin C:\dev\appName:

logger = logging.getLogger()
fh = logging.FileHandler('.\log.txt')
logger.addHandler(fh)
0
source

Source: https://habr.com/ru/post/1616458/


All Articles