Invalid scrapy setting logging?

in pipelines, the code is as follows:

import logging
from scrapy.utils.log import configure_logging

configure_logging(install_root_handler=False)
logging.basicConfig(
    filename="log.txt",
    format="%(levelname)s: %(message)s",
    level=logging.INFO
)  
logging.error("s")

will output on the console SRAV 2018-11-12 19:19:53 [root] ERROR: s
will not be output to the set log.txt.
Why?

Mar.26,2022

has encountered a similar problem, which I haven't solved completely, which may be due to the global setting problem of logging. Because logging is in singleton mode, and basicConfig will not work if root logging is already set up. In large projects, you should make global settings for logging before reading all modules, otherwise conflicts may occur.


if it has been set in other modules, it cannot be set again. I also encountered it today when I found that there was basicConfig in one of my modules, causing the subsequent settings to be invalid.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b303d7-2b476.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b303d7-2b476.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?