diff options
author | randomdan <randomdan@localhost> | 2013-08-19 00:10:14 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2013-08-19 00:10:14 +0000 |
commit | be33f62b26ddce0f66b4204220743588daaa8eba (patch) | |
tree | 7ab600cc42bb5a0fbcc990ba98b366d043c2a13d | |
parent | Use CXX from the environment (diff) | |
download | project2-be33f62b26ddce0f66b4204220743588daaa8eba.tar.bz2 project2-be33f62b26ddce0f66b4204220743588daaa8eba.tar.xz project2-be33f62b26ddce0f66b4204220743588daaa8eba.zip |
Centralise and improve notfound and exception logging
-rw-r--r-- | project2/cgi/cgiAppEngine.cpp | 6 | ||||
-rw-r--r-- | 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 |