Fixed #28810 -- Replaced '%' style logging formatting with str.format() style.

This commit is contained in:
Chris Lamb 2017-11-19 09:15:08 +09:00 committed by Tim Graham
parent bf49d9eb0b
commit 3af305e8b8
2 changed files with 7 additions and 4 deletions

View File

@ -27,7 +27,8 @@ DEFAULT_LOGGING = {
'formatters': {
'django.server': {
'()': 'django.utils.log.ServerFormatter',
'format': '[%(server_time)s] %(message)s',
'format': '[{server_time}] {message}',
'style': '{',
}
},
'handlers': {
@ -190,4 +191,4 @@ class ServerFormatter(logging.Formatter):
return super().format(record)
def uses_server_time(self):
return self._fmt.find('%(server_time)') >= 0
return self._fmt.find('{server_time}') >= 0

View File

@ -299,10 +299,12 @@ Finally, here's an example of a fairly complex logging setup::
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
'format': '{levelname} {asctime} {module} {process:d} {thread:d} {message}',
'style': '{',
},
'simple': {
'format': '%(levelname)s %(message)s'
'format': '{levelname} {message}',
'style': '{',
},
},
'filters': {