Move muranodashboard logs to a separate file.
Default file location is /var/log/murano-dashboard.log (hard-coded into horizon config, still have to make it more flexible). In this separate file we have the same log levels which were specified in code (contrary to ubiquitous [error] in apache logs). Fixes: bug MRN-745. Change-Id: Id4977b40cebba7e1fada055443c6c26ab64d9584
This commit is contained in:
parent
d4a9eb9740
commit
8efc260e9b
|
@ -75,7 +75,6 @@ class PasswordField(CharField):
|
|||
return name + '-clone'
|
||||
|
||||
def compare(self, name, form_data):
|
||||
log.debug('Inside PasswordField compare method')
|
||||
if self.is_original() and self.required:
|
||||
# run compare only for original fields
|
||||
# do not run compare for hidden fields (they are not required)
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import logging
|
||||
import traceback
|
||||
import os
|
||||
import sys
|
||||
|
||||
from django.http import HttpResponseServerError
|
||||
from openstack_dashboard import exceptions
|
||||
from muranoclient.common import exceptions as muranoclient
|
||||
|
||||
|
@ -65,6 +66,15 @@ HORIZON_CONFIG = {
|
|||
}
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ExceptionMiddleware(object):
|
||||
def process_exception(self, request, exception):
|
||||
logger.error(traceback.format_exc())
|
||||
return HttpResponseServerError()
|
||||
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
|
|
|
@ -118,6 +118,11 @@ HORIZON_CONFIG['exceptions']['not_found'] = EXTENDED_NOT_FOUND_EXCEPTIONS
|
|||
HORIZON_CONFIG['exceptions']['unauthorized'] = EXTENDED_UNAUTHORIZED_EXCEPTIONS
|
||||
HORIZON_CONFIG['customization_module'] = 'muranodashboard.panel.overrides'
|
||||
INSTALLED_APPS += ('muranodashboard','djblets','djblets.datagrid','djblets.util','floppyforms',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.settings.ExceptionMiddleware',)
|
||||
LOGGING['formatters'] = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
|
||||
LOGGING['handlers']['file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '/var/log/murano-dashboard.log'}
|
||||
LOGGING['loggers']['muranodashboard'] = {'handlers': ['file'], 'level': 'DEBUG'}
|
||||
LOGGING['loggers']['muranoclient'] = {'handlers': ['file'], 'level': 'ERROR'}
|
||||
#if murano-api set up with ssl uncomment next strings
|
||||
#MURANO_API_INSECURE = True
|
||||
#END_MURANO_DASHBOARD
|
||||
|
@ -191,6 +196,7 @@ postinst()
|
|||
{
|
||||
rebuildstatic
|
||||
sleep 2
|
||||
chown dashboard:dashboard /var/log/murano-dashboard.log
|
||||
service httpd restart
|
||||
}
|
||||
|
||||
|
|
6
setup.sh
6
setup.sh
|
@ -99,6 +99,11 @@ HORIZON_CONFIG['exceptions']['not_found'] = EXTENDED_NOT_FOUND_EXCEPTIONS
|
|||
HORIZON_CONFIG['exceptions']['unauthorized'] = EXTENDED_UNAUTHORIZED_EXCEPTIONS
|
||||
HORIZON_CONFIG['customization_module'] = 'muranodashboard.panel.overrides'
|
||||
INSTALLED_APPS += ('muranodashboard','djblets','djblets.datagrid','djblets.util','floppyforms',)
|
||||
MIDDLEWARE_CLASSES += ('muranodashboard.settings.ExceptionMiddleware',)
|
||||
LOGGING['formatters'] = {'verbose': {'format': '[%(asctime)s] [%(levelname)s] [pid=%(process)d] %(message)s'}}
|
||||
LOGGING['handlers']['file'] = {'level': 'DEBUG', 'formatter': 'verbose', 'class': 'logging.FileHandler', 'filename': '/var/log/murano-dashboard.log'}
|
||||
LOGGING['loggers']['muranodashboard'] = {'handlers': ['file'], 'level': 'DEBUG'}
|
||||
LOGGING['loggers']['muranoclient'] = {'handlers': ['file'], 'level': 'ERROR'}
|
||||
#if murano-api set up with ssl uncomment next strings
|
||||
#MURANO_API_INSECURE = True
|
||||
#END_MURANO_DASHBOARD
|
||||
|
@ -269,6 +274,7 @@ postinst()
|
|||
{
|
||||
rebuildstatic
|
||||
sleep 2
|
||||
chown www-data:www-data /var/log/murano-dashboard.log
|
||||
service apache2 restart
|
||||
}
|
||||
# Command line args'
|
||||
|
|
Loading…
Reference in New Issue