[bknr-cvs] edi changed trunk/thirdparty/hunchentoot/

BKNR Commits bknr at bknr.net
Sun Dec 27 23:12:40 UTC 2009


Revision: 4492
Author: edi
URL: http://bknr.net/trac/changeset/4492

Backtraces

U   trunk/thirdparty/hunchentoot/CHANGELOG
U   trunk/thirdparty/hunchentoot/acceptor.lisp
U   trunk/thirdparty/hunchentoot/conditions.lisp
U   trunk/thirdparty/hunchentoot/doc/index.xml
U   trunk/thirdparty/hunchentoot/hunchentoot.asd
U   trunk/thirdparty/hunchentoot/packages.lisp
U   trunk/thirdparty/hunchentoot/specials.lisp
U   trunk/thirdparty/hunchentoot/util.lisp

Modified: trunk/thirdparty/hunchentoot/CHANGELOG
===================================================================
--- trunk/thirdparty/hunchentoot/CHANGELOG	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/CHANGELOG	2009-12-27 23:12:39 UTC (rev 4492)
@@ -1,5 +1,6 @@
 Architectural changes - see HANDLE-REQUEST (thanks to Andreas Fuchs and Frode Fjeld)
 Re-introduced *CATCH-ERRORS-P* and MAYBE-INVOKE-DEBUGGER
+Integration with trivial-backtrace (see *LOG-LISP-BACKTRACES-P*)
 Treat :UNSPECIFIC like NIL in pathname components (reported by Frode Fjeld)
 Prepare for LispWorks 6 (Nico de Jager)
 Fix reading of post parameters (Peter Seibel)

Modified: trunk/thirdparty/hunchentoot/acceptor.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/acceptor.lisp	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/acceptor.lisp	2009-12-27 23:12:39 UTC (rev 4492)
@@ -437,7 +437,10 @@
   (handler-bind ((error
                   (lambda (cond)
                     (when *log-lisp-errors-p*
-                      (log-message *lisp-errors-log-level* "~A" cond))
+                      (log-message *lisp-errors-log-level*
+                                   "~A~:[~*~;~%~:*~A~]"
+                                   cond
+                                   (and *log-lisp-backtraces-p* (get-backtrace))))
                     ;; if the headers were already sent, the error
                     ;; happened within the body and we have to close
                     ;; the stream
@@ -449,4 +452,5 @@
                   (lambda (cond)
                     (when *log-lisp-warnings-p*
                       (log-message *lisp-warnings-log-level* "~A" cond)))))
-    (funcall (acceptor-request-dispatcher *acceptor*) *request*)))
\ No newline at end of file
+    (with-debugger
+      (funcall (acceptor-request-dispatcher *acceptor*) *request*))))

Modified: trunk/thirdparty/hunchentoot/conditions.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/conditions.lisp	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/conditions.lisp	2009-12-27 23:12:39 UTC (rev 4492)
@@ -113,4 +113,13 @@
 (defmacro handler-case* (expression &rest clauses)
   "Like HANDLER-CASE, but observes *CATCH-ERRORS-P*."
   `(handler-case (with-debugger ,expression)
-     , at clauses))
\ No newline at end of file
+     , at clauses))
+
+(defun get-backtrace ()
+  "Returns a string with a backtrace of what the Lisp system thinks is
+the \"current\" error."
+  (handler-case
+      (with-output-to-string (s)
+        (trivial-backtrace:print-backtrace-to-stream s))
+    (error (condition)
+      (format nil "Could not generate backtrace: ~A." condition))))

Modified: trunk/thirdparty/hunchentoot/doc/index.xml
===================================================================
--- trunk/thirdparty/hunchentoot/doc/index.xml	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/doc/index.xml	2009-12-27 23:12:39 UTC (rev 4492)
@@ -85,6 +85,7 @@
       <li>Kevin Rosenberg's <a href="http://www.cliki.net/cl-base64">CL-BASE64</a>,</li>
       <li>Janis Dzerins' <a href="http://common-lisp.net/project/rfc2388/">RFC2388</a>,</li>
       <li>Peter Seibel's <a href="http://weitz.de/cl-fad/">CL-FAD</a>,</li>
+      <li>Gary King's <a href="http://common-lisp.net/project/trivial-backtrace/">trivial-backtrace</a>,</li>
       <li>Erik Huelsmann's <a href="http://common-lisp.net/project/usocket">usocket</a> (unless you're using LispWorks),</li>
       <li>Greg Pfeil's <a href="http://common-lisp.net/project/bordeaux-threads/">Bordeaux
           Threads</a> (unless you're using LispWorks),
@@ -2588,6 +2589,13 @@
     </clix:description>
   </clix:special-variable>
 
+  <clix:special-variable name='*log-lisp-backtraces-p*'>
+    <clix:description>Whether Lisp backtraces should be logged.  Only
+    has an effect if <clix:ref>*LOG-LISP-ERRORS-P*</clix:ref> is true
+    as well.
+    </clix:description>
+  </clix:special-variable>
+
   <clix:special-variable name='*log-lisp-warnings-p*'>
     <clix:description>Whether Lisp warnings in request handlers should be logged.
     </clix:description>

Modified: trunk/thirdparty/hunchentoot/hunchentoot.asd
===================================================================
--- trunk/thirdparty/hunchentoot/hunchentoot.asd	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/hunchentoot.asd	2009-12-27 23:12:39 UTC (rev 4492)
@@ -51,6 +51,7 @@
                #-(or :lispworks :hunchentoot-no-ssl) :cl+ssl
                :md5
                :rfc2388
+               :trivial-backtrace
                #-:lispworks :usocket
                #-:lispworks :bordeaux-threads)
   :components ((:module url-rewrite

Modified: trunk/thirdparty/hunchentoot/packages.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/packages.lisp	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/packages.lisp	2009-12-27 23:12:39 UTC (rev 4492)
@@ -59,6 +59,7 @@
            "*LISP-ERRORS-LOG-LEVEL*"
            "*LISP-WARNINGS-LOG-LEVEL*"
            "*LISTENER*"
+           "*LOG-LISP-BACKTRACES-P*"
            "*LOG-LISP-ERRORS-P*"
            "*LOG-LISP-WARNINGS-P*"
            "*MESSAGE-LOG-PATHNAME*"
@@ -71,6 +72,7 @@
            "*SESSION-MAX-TIME*"
            "*SESSION-REMOVAL-HOOK*"
            "*SESSION-SECRET*"
+           "*SHOW-LISP-BACKTRACES-P*"
            "*SHOW-LISP-ERRORS-P*"
            "*TMP-DIRECTORY*"
            "*USE-REMOTE-ADDR-FOR-SESSIONS*"

Modified: trunk/thirdparty/hunchentoot/specials.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/specials.lisp	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/specials.lisp	2009-12-27 23:12:39 UTC (rev 4492)
@@ -199,6 +199,10 @@
 (defvar *log-lisp-errors-p* t
   "Whether Lisp errors in request handlers should be logged.")
 
+(defvar *log-lisp-backtraces-p* t
+  "Whether Lisp backtraces should be logged.  Only has an effect if
+*LOG-LISP-ERRORS-P* is true as well.")
+
 (defvar *log-lisp-warnings-p* t
   "Whether Lisp warnings in request handlers should be logged.")
 

Modified: trunk/thirdparty/hunchentoot/util.lisp
===================================================================
--- trunk/thirdparty/hunchentoot/util.lisp	2009-12-27 21:53:14 UTC (rev 4491)
+++ trunk/thirdparty/hunchentoot/util.lisp	2009-12-27 23:12:39 UTC (rev 4492)
@@ -327,4 +327,4 @@
   `(progn , at body)
   #-:lispworks
   `(usocket:with-mapped-conditions ()
-    , at body))
\ No newline at end of file
+    , at body))





More information about the Bknr-cvs mailing list