mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix issue of double logging in ipa_error.log.
We open the log in ipa_webgui and this was being inherited by TurboGears which uses the same log so everything was getting logged twice. Shut down the log in ipa_webgui at the last possible moment. This will not catch configuration errors. Add a Not Found template. Only print a traceback on 500 errors.
This commit is contained in:
parent
c58b7a3d7c
commit
9bcd31efc5
@ -140,11 +140,13 @@ def main():
|
|||||||
|
|
||||||
if devel:
|
if devel:
|
||||||
logging.basicConfig(level=loglevel,
|
logging.basicConfig(level=loglevel,
|
||||||
|
format='%(asctime)s %(name)s %(levelname)s %(message)s',
|
||||||
stream=sys.stderr)
|
stream=sys.stderr)
|
||||||
else:
|
else:
|
||||||
# This log file name needs to be kept in sync with the one in
|
# This log file name needs to be kept in sync with the one in
|
||||||
# ipa_webgui.cfg
|
# ipa_webgui.cfg
|
||||||
logging.basicConfig(level=loglevel,
|
logging.basicConfig(level=loglevel,
|
||||||
|
format='%(asctime)s %(name)s %(levelname)s %(message)s',
|
||||||
filename='/var/log/ipa_error.log')
|
filename='/var/log/ipa_error.log')
|
||||||
|
|
||||||
sys.path.append("/usr/share/ipa")
|
sys.path.append("/usr/share/ipa")
|
||||||
@ -159,6 +161,11 @@ def main():
|
|||||||
import cherrypy
|
import cherrypy
|
||||||
cherrypy.lowercase_api = True
|
cherrypy.lowercase_api = True
|
||||||
|
|
||||||
|
# Shut down the logging set up here so that CherryPy logging can take
|
||||||
|
# over. TurboGears configuration errors will not be caught.
|
||||||
|
if not devel:
|
||||||
|
logging.shutdown()
|
||||||
|
|
||||||
# Load the config - look for a local file first for development
|
# Load the config - look for a local file first for development
|
||||||
# and then the system config file
|
# and then the system config file
|
||||||
if devel:
|
if devel:
|
||||||
|
@ -95,10 +95,12 @@ args='(sys.stdout,)'
|
|||||||
level='DEBUG'
|
level='DEBUG'
|
||||||
qualname='ipagui'
|
qualname='ipagui'
|
||||||
handlers=['debug_out']
|
handlers=['debug_out']
|
||||||
|
propagate=0
|
||||||
|
|
||||||
[[[allinfo]]]
|
[[[allinfo]]]
|
||||||
level='INFO'
|
level='INFO'
|
||||||
handlers=['debug_out']
|
handlers=['debug_out']
|
||||||
|
propagate=0
|
||||||
|
|
||||||
[[[access]]]
|
[[[access]]]
|
||||||
level='INFO'
|
level='INFO'
|
||||||
|
@ -88,6 +88,7 @@ identity.provider='proxyprovider'
|
|||||||
# identity associated with a request? Comma separated list of identity sources.
|
# identity associated with a request? Comma separated list of identity sources.
|
||||||
# Valid sources: form, visit, http_auth
|
# Valid sources: form, visit, http_auth
|
||||||
# identity.source="form,http_auth,visit"
|
# identity.source="form,http_auth,visit"
|
||||||
|
identity.source="visit"
|
||||||
|
|
||||||
# compress the data sends to the web browser
|
# compress the data sends to the web browser
|
||||||
# [/]
|
# [/]
|
||||||
|
@ -84,10 +84,13 @@ class Root(controllers.RootController):
|
|||||||
"""This method is derived from the sample error catcher on
|
"""This method is derived from the sample error catcher on
|
||||||
http://docs.turbogears.org/1.0/ErrorReporting."""
|
http://docs.turbogears.org/1.0/ErrorReporting."""
|
||||||
try:
|
try:
|
||||||
cherrypy._cputil._cp_on_http_error(status, message)
|
|
||||||
error_msg = self._error_codes.get(status, self._error_codes[None])
|
error_msg = self._error_codes.get(status, self._error_codes[None])
|
||||||
url = "%s %s" % (cherrypy.request.method, cherrypy.request.path)
|
url = "%s %s" % (cherrypy.request.method, cherrypy.request.path)
|
||||||
log.exception("CherryPy %s error (%s) for request '%s'", status,
|
if (status == 500):
|
||||||
|
log.exception("%s error (%s) for request '%s'", status,
|
||||||
|
error_msg, url)
|
||||||
|
else:
|
||||||
|
log.error("%s error (%s) for request '%s'", status,
|
||||||
error_msg, url)
|
error_msg, url)
|
||||||
|
|
||||||
if config.get('server.environment') == 'production':
|
if config.get('server.environment') == 'production':
|
||||||
@ -106,9 +109,14 @@ class Root(controllers.RootController):
|
|||||||
details = details,
|
details = details,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if status == 404:
|
||||||
|
page_template = 'ipagui.templates.not_found'
|
||||||
|
else:
|
||||||
|
page_template = 'ipagui.templates.unhandled_exception'
|
||||||
|
|
||||||
body = controllers._process_output(
|
body = controllers._process_output(
|
||||||
data,
|
data,
|
||||||
'ipagui.templates.unhandled_exception',
|
page_template,
|
||||||
'html',
|
'html',
|
||||||
'text/html',
|
'text/html',
|
||||||
None
|
None
|
||||||
|
@ -25,6 +25,7 @@ app_DATA = \
|
|||||||
ipapolicyshow.kid \
|
ipapolicyshow.kid \
|
||||||
loginfailed.kid \
|
loginfailed.kid \
|
||||||
master.kid \
|
master.kid \
|
||||||
|
not_found.kid \
|
||||||
policyindex.kid \
|
policyindex.kid \
|
||||||
policylayout.kid \
|
policylayout.kid \
|
||||||
principallayout.kid \
|
principallayout.kid \
|
||||||
|
37
ipa-server/ipa-gui/ipagui/templates/not_found.kid
Normal file
37
ipa-server/ipa-gui/ipagui/templates/not_found.kid
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) 2007-2008 Red Hat
|
||||||
|
see file 'COPYING' for use and warranty information
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation; version 2 only
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
-->
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:py="http://purl.org/kid/ns#"
|
||||||
|
py:extends="'master.kid'">
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" py:replace="''"/>
|
||||||
|
<title>Page Not Found</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div id="main_content">
|
||||||
|
<h1>Page Not Found</h1>
|
||||||
|
<div py:if='message'>
|
||||||
|
${message}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user