From 51dcc33b164f9f103b43371c588464654d946041 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Mon, 10 Apr 2017 16:52:55 +0000 Subject: [PATCH] Include logging level to log message by default Currently logging level is not included in the default configuration. Even though it can be customized, it would be nice and helpful if the default logging configuration includes it. Apache2 mod_wsgi outputs timestamp when logging messages, so I do not include %(asctime)s in the proposed format and removes it from the operation log format. If WSGI framework you use does not output timestamp you can add it to the formats and it is mentioned as the inline comment. Closes-Bug: #1681507 Change-Id: Id0efdd00712ac71ef1739364e441918d4648d88c --- openstack_dashboard/local/local_settings.py.example | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/local/local_settings.py.example b/openstack_dashboard/local/local_settings.py.example index 453fb6f90f..62b80eac17 100644 --- a/openstack_dashboard/local/local_settings.py.example +++ b/openstack_dashboard/local/local_settings.py.example @@ -495,11 +495,18 @@ LOGGING = { # if nothing is specified here and disable_existing_loggers is True, # django.db.backends will still log unless it is disabled explicitly. 'disable_existing_loggers': False, + # If apache2 mod_wsgi is used to deploy OpenStack dashboard + # timestamp is output by mod_wsgi. If WSGI framework you use does not + # output timestamp for logging, add %(asctime)s in the following + # format definitions. 'formatters': { + 'console': { + 'format': '%(levelname)s %(name)s %(message)s' + }, 'operation': { # The format of "%(message)s" is defined by # OPERATION_LOG_OPTIONS['format'] - 'format': '%(asctime)s %(message)s' + 'format': '%(message)s' }, }, 'handlers': { @@ -511,6 +518,7 @@ LOGGING = { # Set the level to "DEBUG" for verbose output logging. 'level': 'INFO', 'class': 'logging.StreamHandler', + 'formatter': 'console', }, 'operation': { 'level': 'INFO',