You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by ro...@apache.org on 2007/08/21 19:52:35 UTC
svn commit: r568215 - in /tcl/websh/trunk: CHANGES src/ChangeLog
src/generic/interpool.c src/generic/mod_websh.c
Author: ronnie
Date: Tue Aug 21 10:52:34 2007
New Revision: 568215
URL: http://svn.apache.org/viewvc?rev=568215&view=rev
Log:
- better error logging in mod_websh
Modified:
tcl/websh/trunk/CHANGES
tcl/websh/trunk/src/ChangeLog
tcl/websh/trunk/src/generic/interpool.c
tcl/websh/trunk/src/generic/mod_websh.c
Modified: tcl/websh/trunk/CHANGES
URL: http://svn.apache.org/viewvc/tcl/websh/trunk/CHANGES?rev=568215&r1=568214&r2=568215&view=diff
==============================================================================
--- tcl/websh/trunk/CHANGES (original)
+++ tcl/websh/trunk/CHANGES Tue Aug 21 10:52:34 2007
@@ -9,6 +9,8 @@
Trunk
-----
+- Better logging when mod_websh cannot get a Tcl interpreter for a request
+
- Fixed http response problem with Apache 2.2.1 and later
- Fixed websh.spec dependencies, paths, and improved installation
@@ -34,8 +36,8 @@
error when exit is called, but not terminate the process either.)
-Websh 3.6.b4 (2006-03-05)
--------------------------
+Websh 3.6.0b4 (2006-03-05)
+--------------------------
- Added Tcl [memory] command to mod_websh when compiled with TCL_MEM_DEBUG
(Note: Tcl must also be compiled with TCL_MEM_DEBUG for this to work)
@@ -58,8 +60,8 @@
- Configuration and test compatibility fixes for OSX Darwin
-Websh 3.6.b3 (2005-11-11)
--------------------------
+Websh 3.6.0b3 (2005-11-11)
+--------------------------
- Windows XP Makefile provided (for Visual Studio 6 nmake)
@@ -68,8 +70,8 @@
- Added simple setup example for mod_websh
-Websh 3.6.b2 (2005-10-28)
--------------------------
+Websh 3.6.0b2 (2005-10-28)
+--------------------------
- Renamed [web::logfilter] to [web::loglevel] (kept [web::logfilter] for
compatibility)
Modified: tcl/websh/trunk/src/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/websh/trunk/src/ChangeLog?rev=568215&r1=568214&r2=568215&view=diff
==============================================================================
--- tcl/websh/trunk/src/ChangeLog (original)
+++ tcl/websh/trunk/src/ChangeLog Tue Aug 21 10:52:34 2007
@@ -1,11 +1,16 @@
+2007-08-21 Brunner Ronnie <ro...@netcetera.ch>
+ * src/generic/mod_websh.c, src/generic/interpool.c:
+ - better logging when no interpreter can be found
+ - removed unnecessary newlines from error log
+
2007-04-30 Brunner Ronnie <ro...@netcetera.ch>
- * generic/response_ap.c:
+ * src/generic/response_ap.c:
- fix http response for Apache 2.2.1 and later
2007-03-19 Brunner Ronnie <ro...@netcetera.ch>
- * generic/hashutl.c, src/generic/hashutl.h, src/generic/log.c,
+ * src/generic/hashutl.c, src/generic/hashutl.h, src/generic/log.c,
src/generic/log.h, src/generic/macros.h, src/generic/paramlist.c,
src/generic/paramlist.h, src/generic/web.c, src/generic/web.h,
src/generic/webout.h, src/generic/weboutint.c, src/generic/webutl.c,
Modified: tcl/websh/trunk/src/generic/interpool.c
URL: http://svn.apache.org/viewvc/tcl/websh/trunk/src/generic/interpool.c?rev=568215&r1=568214&r2=568215&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/interpool.c (original)
+++ tcl/websh/trunk/src/generic/interpool.c Tue Aug 21 10:52:34 2007
@@ -118,10 +118,10 @@
if (webInterp->interp == NULL) {
Tcl_Free((char *) webInterp);
#ifndef APACHE2
- ap_log_printf(conf->server, "createWebInterp: Could not create interpreter (id %ld, class %s)\n", webInterpClass->nextid, filename);
+ ap_log_printf(conf->server, "createWebInterp: Could not create interpreter (id %ld, class %s)", webInterpClass->nextid, filename);
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, conf->server,
- "createWebInterp: Could not create interpreter (id %ld, class %s)\n", webInterpClass->nextid, filename);
+ "createWebInterp: Could not create interpreter (id %ld, class %s)", webInterpClass->nextid, filename);
#endif /* APACHE2 */
return NULL;
}
@@ -221,11 +221,11 @@
webInterp->code = NULL;
#ifndef APACHE2
ap_log_printf(r->server,
- "Could not readWebInterpCode (id %ld, class %s): %s\n",
+ "Could not readWebInterpCode (id %ld, class %s): %s",
webInterp->id, filename, Tcl_GetStringResult(webInterp->interp));
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
- "Could not readWebInterpCode (id %ld, class %s): %s\n",
+ "Could not readWebInterpCode (id %ld, class %s): %s",
webInterp->id, filename, Tcl_GetStringResult(webInterp->interp));
#endif /* APACHE2 */
}
@@ -251,11 +251,11 @@
r = (request_rec *) Tcl_GetAssocData(webInterp->interp, WEB_AP_ASSOC_DATA, NULL);
#ifndef APACHE2
ap_log_printf(r->server,
- "web::finalize error: %s\n",
+ "web::finalize error: %s",
Tcl_GetStringResult(webInterp->interp));
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
- "web::finalize error: %s\n",
+ "web::finalize error: %s",
Tcl_GetStringResult(webInterp->interp));
#endif /* APACHE2 */
}
@@ -326,16 +326,24 @@
Tcl_DecrRefCount(cmdList[0]);
Tcl_DecrRefCount(cmdList[1]);
- idObj = Tcl_DuplicateObj(Tcl_GetObjResult(conf->mainInterp));
- Tcl_ResetResult(conf->mainInterp);
-
if (res != TCL_OK) {
/* no valid id for filename */
Tcl_MutexUnlock(&(conf->mainInterpLock));
- Tcl_DecrRefCount(idObj);
+#ifndef APACHE2
+ ap_log_printf(r->server,
+ "web::interpmap: %s",
+ Tcl_GetStringResult(conf->mainInterp));
+#else /* APACHE2 */
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "web::interpmap: %s",
+ Tcl_GetStringResult(conf->mainInterp));
+#endif /* APACHE2 */
return NULL;
}
+ idObj = Tcl_DuplicateObj(Tcl_GetObjResult(conf->mainInterp));
+ Tcl_ResetResult(conf->mainInterp);
+
/* get absolute filename (if already absolute, same as
Tcl_GetString(idObj) -> no DecrRefCount yet) */
id = (char *) ap_server_root_relative(r->pool, Tcl_GetString(idObj));
@@ -347,6 +355,13 @@
Tcl_Stat(id, &statPtr) != TCL_OK)
{
Tcl_MutexUnlock(&(conf->mainInterpLock));
+#ifndef APACHE2
+ ap_log_printf(r->server,
+ "cannot access or stat webInterpClass file '%s'", id);
+#else /* APACHE2 */
+ ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
+ "cannot access or stat webInterpClass file '%s'", id);
+#endif /* APACHE2 */
Tcl_DecrRefCount(idObj);
return NULL;
}
@@ -438,14 +453,14 @@
else {
Tcl_MutexUnlock(&(conf->webshPoolLock));
- Tcl_DecrRefCount(idObj);
#ifndef APACHE2
ap_log_printf(conf->server,
- "panic - cannot create webInterpClass '%s'\n", id);
+ "cannot create webInterpClass '%s'", id);
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, conf->server,
- "panic - cannot create webInterpClass '%s'\n", id);
+ "cannot create webInterpClass '%s'", id);
#endif /* APACHE2 */
+ Tcl_DecrRefCount(idObj);
return NULL;
}
}
@@ -514,10 +529,10 @@
if (conf->mainInterp != NULL || conf->webshPool != NULL) {
/* we have to cleanup */
#ifndef APACHE2
- ap_log_printf(conf->server, "initPool: mainInterp or webshPool not NULL\n");
+ ap_log_printf(conf->server, "initPool: mainInterp or webshPool not NULL");
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, conf->server,
- "initPool: mainInterp or webshPool not NULL\n");
+ "initPool: mainInterp or webshPool not NULL");
#endif /* APACHE2 */
return 0;
}
@@ -528,10 +543,10 @@
if (conf->mainInterp == NULL) {
errno = 0;
#ifndef APACHE2
- ap_log_printf(conf->server, "could'nt create main interp\n");
+ ap_log_printf(conf->server, "could'nt create main interp");
#else /* APACHE2 */
ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, conf->server,
- "could'nt create main interp\n");
+ "could'nt create main interp");
#endif /* APACHE2 */
return 0;
}
Modified: tcl/websh/trunk/src/generic/mod_websh.c
URL: http://svn.apache.org/viewvc/tcl/websh/trunk/src/generic/mod_websh.c?rev=568215&r1=568214&r2=568215&view=diff
==============================================================================
--- tcl/websh/trunk/src/generic/mod_websh.c (original)
+++ tcl/websh/trunk/src/generic/mod_websh.c Tue Aug 21 10:52:34 2007
@@ -209,7 +209,7 @@
&websh_module);
if (!initPool(conf)) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
- "Could not init interp pool\n");
+ "Could not init interp pool");
return;
}
apr_pool_cleanup_register(p, s, exit_websh_pool, exit_websh_pool);
@@ -224,7 +224,7 @@
&websh_module);
if (!initPool(conf)) {
ap_log_error(APLOG_MARK, APLOG_ERR, s,
- "Could not init interp pool\n");
+ "Could not init interp pool");
return;
}
}
@@ -252,21 +252,21 @@
#ifndef APACHE2
- /* ap_log_printf(r->server,"mtime of %s: %ld\n",r->filename,r->finfo.st_mtime); */
+ /* ap_log_printf(r->server,"mtime of %s: %ld",r->filename,r->finfo.st_mtime); */
webInterp = poolGetWebInterp(conf, r->filename, r->finfo.st_mtime, r);
if (webInterp == NULL || webInterp->interp == NULL) {
- ap_log_printf(r->server, "mod_websh - no interp !\n");
+ ap_log_printf(r->server, "mod_websh - no interp!");
return 0;
}
#else /* APACHE2 */
- /* ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "mtime of %s: %ld\n",r->filename,r->finfo.mtime); */
+ /* ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "mtime of %s: %ld",r->filename,r->finfo.mtime); */
webInterp = poolGetWebInterp(conf, r->filename, (long) r->finfo.mtime, r);
/* ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, "got pool %p", webInterp); */
if (webInterp == NULL || webInterp->interp == NULL) {
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - no interp !\n");
+ "mod_websh - no interp!");
return 0;
}
@@ -275,10 +275,10 @@
if (Tcl_InterpDeleted(webInterp->interp)) {
#ifndef APACHE2
ap_log_printf(r->server,
- "mod_websh - hey, somebody is deleting the interp !\n");
+ "mod_websh - hey, somebody is deleting the interp!");
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - hey, somebody is deleting the interp !\n");
+ "mod_websh - hey, somebody is deleting the interp!");
#endif /* APACHE2 */
return 0;
}
@@ -291,10 +291,10 @@
if (createApchannel(webInterp->interp, r) != TCL_OK) {
#ifndef APACHE2
- ap_log_printf(r->server, "mod_websh - cannot create apchannel\n");
+ ap_log_printf(r->server, "mod_websh - cannot create apchannel");
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - cannot create apchannel\n");
+ "mod_websh - cannot create apchannel");
#endif /* APACHE2 */
return 0;
}
@@ -302,10 +302,10 @@
if (Tcl_Eval(webInterp->interp, "web::ap::perReqInit") != TCL_OK) {
#ifndef APACHE2
ap_log_printf(r->server,
- "mod_websh - cannot init per-request Websh code\n");
+ "mod_websh - cannot init per-request Websh code");
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - cannot init per-request Websh code\n");
+ "mod_websh - cannot init per-request Websh code");
#endif /* APACHE2 */
return 0;
}
@@ -330,20 +330,20 @@
if (Tcl_Eval(webInterp->interp, "web::ap::perReqCleanup") != TCL_OK) {
#ifndef APACHE2
- ap_log_printf(r->server, "mod_websh - error while cleaning-up\n");
+ ap_log_printf(r->server, "mod_websh - error while cleaning-up");
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - error while cleaning-up\n");
+ "mod_websh - error while cleaning-up");
#endif /* APACHE2 */
return 0;
}
if (destroyApchannel(webInterp->interp) != TCL_OK) {
#ifndef APACHE2
- ap_log_printf(r->server, "mod_websh - error closing ap-channel\n");
+ ap_log_printf(r->server, "mod_websh - error closing ap-channel");
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
- "mod_websh - error closing ap-channel\n");
+ "mod_websh - error closing ap-channel");
#endif /* APACHE2 */
return 0;
}
@@ -394,11 +394,13 @@
if (!run_websh_script(r)) {
#ifndef APACHE2
ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+ "couldn't run websh script: %s",
+ r->filename);
#else /* APACHE2 */
ap_log_rerror(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r,
-#endif /* APACHE2 */
"couldn't run websh script: %s",
r->filename);
+#endif /* APACHE2 */
return HTTP_INTERNAL_SERVER_ERROR;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-cvs-help@tcl.apache.org