Skip to content

Commit 8720254

Browse files
committed
Match default values in log.start
This will avoid unexpected outputs when calling log.start explicitly. Main change is setting `logstdout` to False, since it's currently broken and generates issues like scrapy#451.
1 parent 19bb4d3 commit 8720254

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

scrapy/log.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import scrapy
1313
from scrapy.utils.python import unicode_to_str
1414
from scrapy.settings import overridden_settings
15+
from scrapy.settings.default_settings import LOG_FILE, LOG_LEVEL, LOG_STDOUT, LOG_ENCODING
1516

1617
# Logging levels
1718
DEBUG = logging.DEBUG
@@ -111,7 +112,9 @@ def _get_log_level(level_name_or_id):
111112
else:
112113
raise ValueError("Unknown log level: %r" % level_name_or_id)
113114

114-
def start(logfile=None, loglevel='INFO', logstdout=True, logencoding='utf-8', crawler=None):
115+
def start(logfile=LOG_FILE, loglevel=LOG_LEVEL,
116+
logstdout=LOG_STDOUT, logencoding=LOG_ENCODING,
117+
crawler=None):
115118
loglevel = _get_log_level(loglevel)
116119
file = open(logfile, 'a') if logfile else sys.stderr
117120
sflo = ScrapyFileLogObserver(file, loglevel, logencoding, crawler)

0 commit comments

Comments
 (0)