Fixed #29329 -- Made datetime logging from runserver more consistent.
Setting default_msec_format=None will make it the same, unfortunately it's not supported by Python, see https://bugs.python.org/issue40300.
This commit is contained in:
parent
96c6f9c61c
commit
7b31ba541f
|
@ -160,6 +160,8 @@ class RequireDebugTrue(logging.Filter):
|
||||||
|
|
||||||
|
|
||||||
class ServerFormatter(logging.Formatter):
|
class ServerFormatter(logging.Formatter):
|
||||||
|
default_time_format = '%d/%b/%Y %H:%M:%S'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.style = color_style()
|
self.style = color_style()
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
|
@ -605,4 +605,4 @@ class LogFormattersTests(SimpleTestCase):
|
||||||
|
|
||||||
with patch_django_server_logger() as logger_output:
|
with patch_django_server_logger() as logger_output:
|
||||||
logger.info(log_msg)
|
logger.info(log_msg)
|
||||||
self.assertRegex(logger_output.getvalue(), r'^\[[-:,.\s\d]+\] %s' % log_msg)
|
self.assertRegex(logger_output.getvalue(), r'^\[[/:,\w\s\d]+\] %s\n' % log_msg)
|
||||||
|
|
Loading…
Reference in New Issue