summaryrefslogtreecommitdiffstats
path: root/sca-cpp/trunk/modules
diff options
context:
space:
mode:
authorjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
committerjsdelfino <jsdelfino@13f79535-47bb-0310-9956-ffa450edef68>2011-12-23 08:18:38 +0000
commit681567b28116421496c4b7560a5b70f9730b8a79 (patch)
tree527231756f6a291ba35a217e3cd880c2cf15e5e0 /sca-cpp/trunk/modules
parentf55fe8a88efb11b57fcb393ce5958e5dcace24d7 (diff)
Use HTTPD ap_log_error instead of stderr to log when running inside HTTPD, to get log piping and rotation to work.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1222604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-cpp/trunk/modules')
-rwxr-xr-xsca-cpp/trunk/modules/http/httpd-conf2
-rw-r--r--sca-cpp/trunk/modules/http/httpd.hpp5
-rw-r--r--sca-cpp/trunk/modules/http/mod-openauth.cpp26
-rw-r--r--sca-cpp/trunk/modules/http/mod-ssltunnel.cpp1
-rw-r--r--sca-cpp/trunk/modules/java/mod-java.cpp1
-rw-r--r--sca-cpp/trunk/modules/js/eval.hpp7
-rw-r--r--sca-cpp/trunk/modules/oauth/mod-oauth1.cpp1
-rw-r--r--sca-cpp/trunk/modules/oauth/mod-oauth2.cpp1
-rw-r--r--sca-cpp/trunk/modules/python/mod-python.cpp1
-rw-r--r--sca-cpp/trunk/modules/server/mod-eval.cpp1
-rw-r--r--sca-cpp/trunk/modules/server/mod-wiring.cpp1
11 files changed, 28 insertions, 19 deletions
diff --git a/sca-cpp/trunk/modules/http/httpd-conf b/sca-cpp/trunk/modules/http/httpd-conf
index 50134410a9..5bcde9f633 100755
--- a/sca-cpp/trunk/modules/http/httpd-conf
+++ b/sca-cpp/trunk/modules/http/httpd-conf
@@ -81,7 +81,6 @@ HostNameLookups Off
# [timestamp] [access] remote-host remote-ident remote-user "request-line"
# status response-size "referrer" "user-agent" "user-track" local-IP
# virtual-host response-time bytes-received bytes-sent
-LogLevel notice
LogFormat "[%{%a %b %d %H:%M:%S %Y}t] [access] %h %l %u \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" \"%{cookie}n\" %A %V %D %I %O" combined
Include conf/log.conf
@@ -152,6 +151,7 @@ EOF
# Configure logging
cat >$root/conf/log.conf <<EOF
# Generated by: httpd-conf $*
+LogLevel notice
ErrorLog $root/logs/error_log
CustomLog $root/logs/access_log combined
diff --git a/sca-cpp/trunk/modules/http/httpd.hpp b/sca-cpp/trunk/modules/http/httpd.hpp
index 06d53e28c2..f4e3767881 100644
--- a/sca-cpp/trunk/modules/http/httpd.hpp
+++ b/sca-cpp/trunk/modules/http/httpd.hpp
@@ -672,7 +672,6 @@ const char* debugOptional(const char* s) {
* Log a header
*/
int debugHeader(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " header key: " << key << ", value: " << value << endl;
return 1;
}
@@ -681,7 +680,6 @@ int debugHeader(unused void* r, const char* key, const char* value) {
* Log an environment variable
*/
int debugEnv(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " var key: " << key << ", value: " << value << endl;
return 1;
}
@@ -690,7 +688,6 @@ int debugEnv(unused void* r, const char* key, const char* value) {
* Log a note.
*/
int debugNote(unused void* r, const char* key, const char* value) {
- gc_scoped_pool();
cdebug << " note key: " << key << ", value: " << value << endl;
return 1;
}
@@ -699,6 +696,8 @@ int debugNote(unused void* r, const char* key, const char* value) {
* Log a request.
*/
const bool debugRequest(request_rec* r, const string& msg) {
+ if (!isDebugLog())
+ return true;
gc_scoped_pool();
cdebug << msg << ":" << endl;
cdebug << " unparsed uri: " << debugOptional(r->unparsed_uri) << endl;
diff --git a/sca-cpp/trunk/modules/http/mod-openauth.cpp b/sca-cpp/trunk/modules/http/mod-openauth.cpp
index c2791b5402..09d62bf5f7 100644
--- a/sca-cpp/trunk/modules/http/mod-openauth.cpp
+++ b/sca-cpp/trunk/modules/http/mod-openauth.cpp
@@ -33,6 +33,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
@@ -79,13 +80,20 @@ public:
#ifdef WANT_MAINTAINER_MODE
/**
- * Log a session entry.
+ * Log session entries.
*/
-int debugSession(unused void* r, const char* key, const char* value) {
+int debugSessionEntry(unused void* r, const char* key, const char* value) {
cdebug << " session key: " << key << ", value: " << value << endl;
return 1;
}
+const bool debugSession(request_rec* r, session_rec* z) {
+ if (!isDebugLog())
+ return true;
+ apr_table_do(debugSessionEntry, r, z->entries, NULL);
+ return true;
+}
+
#endif
/**
@@ -103,7 +111,7 @@ const failable<value> userInfoFromSession(const string& realm, request_rec* r) {
if (z == NULL)
return mkfailure<value>("Couldn't retrieve user session");
#ifdef WANT_MAINTAINER_MODE
- apr_table_do(debugSession, r, z->entries, NULL);
+ debugSession(r, z);
#endif
if (ap_session_get_fn == NULL)
@@ -225,8 +233,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -236,7 +244,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}
@@ -254,8 +262,8 @@ static int checkAuthn(request_rec *r) {
if (hasContent(info)) {
// Try to authenticate the request
- const value cinfo = content(info);
- const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", cinfo)), cadr(assoc<value>("password", cinfo)), r);
+ const value uinfo = content(info);
+ const failable<int> authz = checkAuthnz(cadr(assoc<value>("id", uinfo)), cadr(assoc<value>("password", uinfo)), r);
if (!hasContent(authz)) {
// Authentication failed, redirect to login page
@@ -265,7 +273,7 @@ static int checkAuthn(request_rec *r) {
// Successfully authenticated, store the user info in the request
r->ap_auth_type = const_cast<char*>(atype);
- return httpd::reportStatus(authenticated(cinfo, r));
+ return httpd::reportStatus(authenticated(uinfo, r));
}
}
diff --git a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
index 521b86626d..49ce6bbe52 100644
--- a/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
+++ b/sca-cpp/trunk/modules/http/mod-ssltunnel.cpp
@@ -25,6 +25,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/java/mod-java.cpp b/sca-cpp/trunk/modules/java/mod-java.cpp
index 510f9574b0..8c25f6f8ef 100644
--- a/sca-cpp/trunk/modules/java/mod-java.cpp
+++ b/sca-cpp/trunk/modules/java/mod-java.cpp
@@ -23,6 +23,7 @@
* HTTPD module used to eval Java component implementations.
*/
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "function.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/js/eval.hpp b/sca-cpp/trunk/modules/js/eval.hpp
index 817ef7e086..17f73f2b43 100644
--- a/sca-cpp/trunk/modules/js/eval.hpp
+++ b/sca-cpp/trunk/modules/js/eval.hpp
@@ -52,13 +52,8 @@ namespace js {
* Report Javascript errors.
*/
void reportError(unused ::JSContext *cx, const char *message, JSErrorReport *report) {
-#ifdef WANT_MAINTAINER_MODE
- cdebug << (const char*)(report->filename? report->filename : "<no filename>") << ":"
- << (int)report->lineno << ":" << message << endl;
-#else
- cerr << (const char*)(report->filename? report->filename : "<no filename>") << ":"
+ cfailure << (const char*)(report->filename? report->filename : "<no filename>") << ":"
<< (int)report->lineno << ":" << message << endl;
-#endif
}
/**
diff --git a/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp b/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp
index 94e9698d70..833dfc96c5 100644
--- a/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp
+++ b/sca-cpp/trunk/modules/oauth/mod-oauth1.cpp
@@ -30,6 +30,7 @@ extern "C" {
#include <oauth.h>
}
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp b/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp
index 0c49be879e..e8c27a5709 100644
--- a/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp
+++ b/sca-cpp/trunk/modules/oauth/mod-oauth2.cpp
@@ -25,6 +25,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/python/mod-python.cpp b/sca-cpp/trunk/modules/python/mod-python.cpp
index f4d2febf10..89a2db1b33 100644
--- a/sca-cpp/trunk/modules/python/mod-python.cpp
+++ b/sca-cpp/trunk/modules/python/mod-python.cpp
@@ -23,6 +23,7 @@
* HTTPD module used to eval Python component implementations.
*/
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "function.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/server/mod-eval.cpp b/sca-cpp/trunk/modules/server/mod-eval.cpp
index a94ccf5bbe..fcc4981ec0 100644
--- a/sca-cpp/trunk/modules/server/mod-eval.cpp
+++ b/sca-cpp/trunk/modules/server/mod-eval.cpp
@@ -23,6 +23,7 @@
* HTTPD module used to eval C++ and Scheme component implementations.
*/
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "function.hpp"
#include "list.hpp"
diff --git a/sca-cpp/trunk/modules/server/mod-wiring.cpp b/sca-cpp/trunk/modules/server/mod-wiring.cpp
index c2380be6a3..0dd0529a42 100644
--- a/sca-cpp/trunk/modules/server/mod-wiring.cpp
+++ b/sca-cpp/trunk/modules/server/mod-wiring.cpp
@@ -26,6 +26,7 @@
#include <sys/stat.h>
+#define WANT_HTTPD_LOG 1
#include "string.hpp"
#include "stream.hpp"
#include "list.hpp"