diff --git a/django/utils/log.py b/django/utils/log.py index 717c15814c..3d3e8701c7 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -160,6 +160,8 @@ class RequireDebugTrue(logging.Filter): class ServerFormatter(logging.Formatter): + default_time_format = '%d/%b/%Y %H:%M:%S' + def __init__(self, *args, **kwargs): self.style = color_style() super().__init__(*args, **kwargs) diff --git a/tests/logging_tests/tests.py b/tests/logging_tests/tests.py index 1967ca3687..c2e26d5102 100644 --- a/tests/logging_tests/tests.py +++ b/tests/logging_tests/tests.py @@ -605,4 +605,4 @@ class LogFormattersTests(SimpleTestCase): with patch_django_server_logger() as logger_output: 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)