From be33f62b26ddce0f66b4204220743588daaa8eba Mon Sep 17 00:00:00 2001 From: randomdan Date: Mon, 19 Aug 2013 00:10:14 +0000 Subject: Centralise and improve notfound and exception logging --- project2/cgi/cgiAppEngine.cpp | 6 ++++-- project2/cgi/cgiStageDefaultNotFound.cpp | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/project2/cgi/cgiAppEngine.cpp b/project2/cgi/cgiAppEngine.cpp index 239170f..872f896 100644 --- a/project2/cgi/cgiAppEngine.cpp +++ b/project2/cgi/cgiAppEngine.cpp @@ -138,7 +138,7 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const currentStage = NextStage(new PresentStage(ScriptReader::resolveScript(presentRoot, cf.failedCheck->present(crc), false), crc)); } catch (const ScriptNotFound & nf) { - Logger()->messagebf(LOG_WARNING, "Script not found processing stage: %s", nf.what()); + Logger()->messagebf(LOG_ERR, "%s: Resource not found: %s", __FUNCTION__, nf.what()); if (notFoundPresent.empty() || triedNotFound) { currentStage = NextStage(new DefaultNotFoundStage(nf)); } @@ -148,7 +148,9 @@ CgiApplicationEngine::process(std::ostream & IO, CgiRequestContext * crc) const } } catch (const std::exception & ex) { - Logger()->messagebf(LOG_WARNING, "Error processing stage: %s", ex.what()); + char * buf = __cxxabiv1::__cxa_demangle(typeid(ex).name(), NULL, NULL, NULL); + Logger()->messagebf(LOG_WARNING, "%s: Error processing stage: %s (what: %s)", __FUNCTION__, buf, ex.what()); + free(buf); if (onErrorPresent.empty() || triedOnError) { currentStage = NextStage(new DefaultErrorStage(ex, crc)); } diff --git a/project2/cgi/cgiStageDefaultNotFound.cpp b/project2/cgi/cgiStageDefaultNotFound.cpp index bfb737f..ad4c697 100644 --- a/project2/cgi/cgiStageDefaultNotFound.cpp +++ b/project2/cgi/cgiStageDefaultNotFound.cpp @@ -11,7 +11,6 @@ CgiApplicationEngine::DefaultNotFoundStage::DefaultNotFoundStage(const ScriptNot nf(notfound), pres(new XmlPresenter(DefaultNotFoundStageResp, CgiApplicationEngine::errorTransformStyle, CgiApplicationEngine::errorContentType)) { - Logger()->messagef(LOG_ERR, "%s: Resource not found: %s", __FUNCTION__, nf.what()); } CgiApplicationEngine::HttpHeaderPtr -- cgit v1.2.3